Roadstar3

HousePainting

Oct 17th, 2019
239
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.06 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class HousePainting {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner(System.in );
  6.         double X = Double.parseDouble(scanner.nextLine());
  7.         double Y = Double.parseDouble(scanner.nextLine());
  8.         double H = Double.parseDouble(scanner.nextLine());
  9.  
  10.         double rearArea = X*X;
  11.         double frontArea = rearArea-(1.2*2);
  12.         double windowArea = 1.5*1.5;
  13.         double sideWallsArea = X*Y;
  14.         double leftSideArea = sideWallsArea-windowArea;
  15.         double rightSideArea = sideWallsArea-windowArea;
  16.  
  17.         double roofArea = (X*Y)*2;
  18.         double roofTriangleArea = (X*H)/2;
  19.         double sumOfRoofTriangles = roofTriangleArea*2;
  20.  
  21.         double sumOfAllWalls = rearArea+frontArea+leftSideArea+rightSideArea;
  22.         double sumOfRoofs = roofArea+sumOfRoofTriangles;
  23.  
  24.         double greenColor = sumOfAllWalls/3.4;
  25.         double redColor = sumOfRoofs/4.3;
  26.         System.out.printf("%.2f%n",greenColor);
  27.         System.out.printf("%.2f",redColor);
  28.     }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment