Answer to Question #230501 in Java | JSP | JSF for ash

Question #230501
  1. Samantha and Vikas are looking to buy a house in a new development. After looking at various models the three models they like are colonial, split-entry, and single-story. The builder gave them the base price and the finished area in square feet of the three models. They want to know the price per square foot of the three models and the model with the least price per square foot. Write a program that accepts as input the base price and the finished area in square feet of the three models. The program outputs the price per square foot of the three models and the model with the least price per square foot.


hoping for answer im so glad this website is make.i shared it on my friend


1
Expert's answer
2021-08-30T02:29:12-0400


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);
       
         
         
         
    }
    
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

Journey Jon Dalina
02.02.23, 08:57

Thank you, this helps a lot

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS