Linda is starting a new cosmetic and clothing business and w
Solution
Hey, there were some problems with the formula, so I have corrected it so that it gives the mathematically correct answer. It would be merchandiseCost in the formula at 2 places instead of total cost. I have checked it several times and it is giving correct result after changing the formula. Please comment in case you have a doubt regarding the same.
Store.java:
import java.util.Scanner;
public class Store {
public static void main(String args[]){
float storeRent, merchandiseCost, electricityCost, employeeSalary;
Scanner scanner = new Scanner(System.in);
System.out.println(\"Enter store Rent \");
storeRent=scanner.nextFloat();
System.out.println(\"Enter merchandise Cost\");
merchandiseCost=scanner.nextFloat();
System.out.println(\"Enter electricity Cost \");
electricityCost=scanner.nextFloat();
System.out.println(\"Enter employee Salary\");
employeeSalary=scanner.nextFloat();
float total=storeRent+ merchandiseCost + electricityCost + employeeSalary;
//System.out.println(\"Year \\t Total Amount Invested \\t Compound Interest \\t Amount earned\");
float markupPrice=(float) (total +(merchandiseCost/10f)) / (float) (.85 * merchandiseCost);
System.out.println(\"Store Rent : \" + storeRent);
System.out.println(\"Merchandise Cost : \"+ merchandiseCost);
System.out.println(\"Electricity Cost : \"+ electricityCost);
System.out.println(\"Employee total salary : \"+ employeeSalary);
System.out.println(\"Total Cost : \"+ total);
System.out.println(\"The merchandise should be marked up by a factor of \" + markupPrice + \" to achieve the desired profit. Hence the total sold price of merchandise must be \" + (markupPrice*merchandiseCost));
scanner.close();
}
}
Sample run 1:
Enter store Rent
500
Enter merchandise Cost
100
Enter electricity Cost
10
Enter employee Salary
50
Store Rent : 500.0
Merchandise Cost : 100.0
Electricity Cost : 10.0
Employee total salary : 50.0
Total Cost : 660.0
The merchandise should be marked up by a factor of 7.882353 to achieve the desired profit. Hence the total sold price of merchandise must be 788.2353
Sample run 2:
Enter store Rent
45260
Enter merchandise Cost
24250
Enter electricity Cost
1550
Enter employee Salary
10000
Store Rent : 45260.0
Merchandise Cost : 24250.0
Electricity Cost : 1550.0
Employee total salary : 10000.0
Total Cost : 81060.0
The merchandise should be marked up by a factor of 4.0502124 to achieve the desired profit. Hence the total sold price of merchandise must be 98217.65

