Advertisement
myrdok123

06. Repainting

Jan 7th, 2024
882
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.49 KB | None | 0 0
  1. package W01FirstStepsInCoding.Exercises;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class P06Repainting {
  6.  
  7.     public static void main(String[] args) {
  8.  
  9.  
  10.         Scanner scanner = new Scanner(System.in);
  11.  
  12.         //Прочитаме входните данни
  13.         int neededNylon = Integer.parseInt(scanner.nextLine());
  14.         int neededPaint = Integer.parseInt(scanner.nextLine());
  15.         int neededThinner = Integer.parseInt(scanner.nextLine());
  16.         int neededHours = Integer.parseInt(scanner.nextLine());
  17.  
  18.         //Пресмятаме необходимотo количество найлон, боя и разредител,
  19.         // като добавяме 10% за боя и разредител и 2кв.м. найлон
  20.  
  21.         double nylonPrice = (neededNylon + 2) * 1.50;
  22.         double paintPrice = (neededPaint + neededPaint * 0.10) * 14.50;
  23.         double thinnerPrice = neededThinner * 5.00;
  24.  
  25.         //Пресмятам общата сума за материалите
  26.         double totalSumForMaterials = nylonPrice + paintPrice + thinnerPrice + 0.40;
  27.  
  28.         //Пресмятаме сумата за труда
  29.         double buildersPrice = (totalSumForMaterials * 0.30) * neededHours;
  30.  
  31.         //Пресмятаме общата сума => сумата за материали + сумата за труд на майсторите
  32.         double totalSum = totalSumForMaterials + buildersPrice;
  33.  
  34.         System.out.println(totalSum);
  35.  
  36.  
  37.  
  38.     }
  39. }
  40.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement