Advertisement
YavorGrancharov

HousePrice

Mar 4th, 2017
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.78 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class HousePrice {
  4.     public static void main(String[] args) {
  5.         Scanner console = new Scanner(System.in);
  6.         double smallestRoom = Double.parseDouble(console.nextLine());
  7.         double areaKitchen = Double.parseDouble(console.nextLine());
  8.         double squareMeterPrice = Double.parseDouble(console.nextLine());
  9.  
  10.         double bathroom = smallestRoom / 2;
  11.         double secondRoom = (smallestRoom * 0.10) + smallestRoom;
  12.         double thirdRoom = (secondRoom * 0.10) + secondRoom;
  13.  
  14.         double sumArea = (areaKitchen + bathroom + smallestRoom + secondRoom + thirdRoom);
  15.         double wholeArea = (sumArea * 0.05) + sumArea;
  16.         double price = wholeArea * squareMeterPrice;
  17.  
  18.         System.out.printf("%.2f", price);
  19.     }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement