Advertisement
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 scan = new Scanner(System.in);
- //Read and store input
- double heightOfTheHouse = Double.parseDouble(scan.nextLine());
- double withRectangleSide = Double.parseDouble(scan.nextLine());
- double hTriangleRoof = Double.parseDouble(scan.nextLine());
- //Calculation about green paint
- double sideWallArea = heightOfTheHouse*withRectangleSide;
- double windowArea = 1.5*1.5;
- double sidesWallTotall = 2 * sideWallArea - 2 * windowArea;
- double door = 1.2*2;
- double backWall = 2*heightOfTheHouse*heightOfTheHouse - door;
- double totalMeters = backWall +sidesWallTotall;
- double green = totalMeters/ 3.4;
- // Calculation red paint roof
- double rectangleRoof = 2 * heightOfTheHouse* withRectangleSide;
- double triangleRoof = 2*(heightOfTheHouse*hTriangleRoof/2);
- double totalRedPaint = rectangleRoof + triangleRoof;
- double redPaintLiters = totalRedPaint/4.3;
- System.out.printf("%.2f%n%.2f",green, redPaintLiters);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement