MladenKarachanov

HousePainting

Jan 24th, 2024
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.02 KB | None | 0 0
  1. package ProgrammingBasics2;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class HousePainting {
  6.     public static void main(String[] args) {
  7.         Scanner scanner = new Scanner(System.in);
  8.         double height = Double.parseDouble(scanner.nextLine());
  9.         double width = Double.parseDouble(scanner.nextLine());
  10.         double roofHeight = Double.parseDouble(scanner.nextLine());
  11.         double area = height*width;
  12.         double window = 1.5*1.5;
  13.         double twoSides=(2*area)-(2*window);
  14.         double door =1.20*2;
  15.         double sideWalls= height*height;
  16.         double frontAndRear=(2*sideWalls)-door;
  17.         double totalArea=twoSides+frontAndRear;
  18.         double greenPaint=totalArea/3.4;
  19.         // Покрив
  20.         double twoRectangles=2*(height*width);
  21.         double twoTriangles=2*(height*roofHeight/2);
  22.         double totalArea2=twoRectangles+twoTriangles;
  23.         double redPaint=totalArea2/4.3;
  24.         System.out.printf("%.2f%n",greenPaint);
  25.         System.out.printf("%.2f",redPaint);
  26.  
  27.     }
  28. }
  29.  
Add Comment
Please, Sign In to add comment