Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package ProgrammingBasics2;
- import java.util.Scanner;
- public class HousePainting {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- double height = Double.parseDouble(scanner.nextLine());
- double width = Double.parseDouble(scanner.nextLine());
- double roofHeight = Double.parseDouble(scanner.nextLine());
- double area = height*width;
- double window = 1.5*1.5;
- double twoSides=(2*area)-(2*window);
- double door =1.20*2;
- double sideWalls= height*height;
- double frontAndRear=(2*sideWalls)-door;
- double totalArea=twoSides+frontAndRear;
- double greenPaint=totalArea/3.4;
- // Покрив
- double twoRectangles=2*(height*width);
- double twoTriangles=2*(height*roofHeight/2);
- double totalArea2=twoRectangles+twoTriangles;
- double redPaint=totalArea2/4.3;
- System.out.printf("%.2f%n",greenPaint);
- System.out.printf("%.2f",redPaint);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement