hoping for answer im so glad this website is make.i shared it on my friend
package buildingmodels;
import java.util.Scanner;
public class BuildingModels {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
double baseColonel, areaColonel, baseSplitEntry, areaSplitEntry, baseSingleStory;
double areaSingleStory;
System.out.println("Enter the base price of the colonel model");
baseColonel = scan.nextDouble();
System.out.println("Enter the finished area in square feet of the colonel model");
areaColonel = scan.nextDouble();
double pricePerFootColonel = baseColonel / areaColonel;
System.out.println("Enter the base price of the Split-Entry model");
baseSplitEntry = scan.nextDouble();
System.out.println("Enter the finished area in square feet of the Split Entry model");
areaSplitEntry = scan.nextDouble();
double pricePerFootSplitEntry = baseSplitEntry / areaSplitEntry;
System.out.println("Enter the base price of the single-story model");
baseSingleStory = scan.nextDouble();
System.out.println("Enter the finished area in square feet of the single-story model");
areaSingleStory = scan.nextDouble();
double pricePerFootSingleStory = baseSingleStory / areaSingleStory;
double cheapest = pricePerFootColonel;
String cheap = "Colonel";
if(pricePerFootSplitEntry<pricePerFootColonel && pricePerFootSplitEntry<pricePerFootSingleStory){
cheapest = pricePerFootSplitEntry;
cheap = "Split-entry";
}
else if(pricePerFootSingleStory<pricePerFootColonel && pricePerFootSplitEntry>pricePerFootSingleStory){
cheapest = pricePerFootSingleStory;
cheap = "Single-story";
}
System.out.println("The price per square of colonel model is: "+pricePerFootColonel);
System.out.println("The price per square of single-story model is: "+pricePerFootSingleStory);
System.out.println("The price per square of Split Entry model is: "+pricePerFootSplitEntry);
System.out.printf("The model with the least price per square foot is: %s ", cheap);
}
}
Comments
Thank you, this helps a lot
Leave a comment