Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class HousePainting {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in );
- double X = Double.parseDouble(scanner.nextLine());
- double Y = Double.parseDouble(scanner.nextLine());
- double H = Double.parseDouble(scanner.nextLine());
- double rearArea = X*X;
- double frontArea = rearArea-(1.2*2);
- double windowArea = 1.5*1.5;
- double sideWallsArea = X*Y;
- double leftSideArea = sideWallsArea-windowArea;
- double rightSideArea = sideWallsArea-windowArea;
- double roofArea = (X*Y)*2;
- double roofTriangleArea = (X*H)/2;
- double sumOfRoofTriangles = roofTriangleArea*2;
- double sumOfAllWalls = rearArea+frontArea+leftSideArea+rightSideArea;
- double sumOfRoofs = roofArea+sumOfRoofTriangles;
- double greenColor = sumOfAllWalls/3.4;
- double redColor = sumOfRoofs/4.3;
- System.out.printf("%.2f%n",greenColor);
- System.out.printf("%.2f",redColor);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment