Advertisement
Tsuki11

Untitled

Oct 17th, 2019
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.17 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class housePainting {
  4.     public static void main(String[] args) {
  5.         Scanner scan = new Scanner(System.in);
  6.  
  7.         //Read and store input
  8.         double heightOfTheHouse = Double.parseDouble(scan.nextLine());
  9.         double withRectangleSide = Double.parseDouble(scan.nextLine());
  10.         double hTriangleRoof = Double.parseDouble(scan.nextLine());
  11.  
  12.         //Calculation about green paint
  13.         double sideWallArea = heightOfTheHouse*withRectangleSide;
  14.         double windowArea = 1.5*1.5;
  15.         double sidesWallTotall = 2 * sideWallArea - 2 * windowArea;
  16.  
  17.         double door = 1.2*2;
  18.         double backWall = 2*heightOfTheHouse*heightOfTheHouse - door;
  19.         double totalMeters = backWall +sidesWallTotall;
  20.         double green =  totalMeters/ 3.4;
  21.  
  22.         // Calculation red paint roof
  23.         double rectangleRoof = 2 * heightOfTheHouse* withRectangleSide;
  24.         double triangleRoof = 2*(heightOfTheHouse*hTriangleRoof/2);
  25.         double totalRedPaint = rectangleRoof + triangleRoof;
  26.         double redPaintLiters = totalRedPaint/4.3;
  27.  
  28.         System.out.printf("%.2f%n%.2f",green, redPaintLiters);
  29.  
  30.     }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement