Advertisement
SotirovG

HausPainting_07

Sep 14th, 2020
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.95 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class HousePainting_07 {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner(System.in);
  6.         // задаваме си променливите който ще 4етем от конзолата
  7.         // 1. x – височината на къщата
  8.         // 2. y – дължината на страничната стена
  9.         // 3. h – височината на триъгълната стена на прокрива
  10.         // * Разхода на зелената боя е 1 литър за 3.4 м2
  11.         // * на червената – 1 литър за 4.3 м2.
  12.         // пе4атаме на 2 отделни реда следните изходи ;
  13.         //  Литрите зелена боя
  14.         //  Литритe червена боя
  15.  
  16.         double windowArea = 2.25;
  17.         double entryDoor =  2.4;
  18.         double backWall = 36;
  19.         double literGreenPaint = 3.4;
  20.         double literRedPaint = 4.3;
  21.  
  22.  
  23.         double high = Double.parseDouble(scanner.nextLine());
  24.         double length = Double.parseDouble(scanner.nextLine());
  25.         double highTriangleWall = Double.parseDouble(scanner.nextLine());
  26.  
  27.         // wallSide - greenColor
  28.  
  29.         double sideArea = length * high;
  30.         double bothSideArea = (sideArea * 2 ) - ( windowArea * 2);
  31.         double bothWall = ( backWall * 2) - entryDoor;
  32.         double totalAreaWallSide = bothSideArea + bothWall;
  33.         double greenPaint = totalAreaWallSide / literGreenPaint;
  34.  
  35.         System.out.printf( "%.2f",greenPaint );
  36.         // roofArea - redColor
  37.  
  38.         double bothRoofSide = 2 * ( high * length );
  39.         double bothRoofTriangle = 2 * (high * highTriangleWall / 2);
  40.         double totalRoofSide = bothRoofSide + bothRoofTriangle ;
  41.  
  42.         double redPaint = totalRoofSide / literRedPaint;
  43.         System.out.printf("%.2f",redPaint );
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.     }
  62. }
  63.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement