Advertisement
veronikaaa86

05. Supplies for School

Oct 31st, 2021
258
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. package firstSteps;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class P05SuppliesForSchool {
  6. public static void main(String[] args) {
  7. Scanner scanner = new Scanner(System.in);
  8.  
  9. int pensCount = Integer.parseInt(scanner.nextLine());
  10. int markersCount = Integer.parseInt(scanner.nextLine());
  11. int litersDetergent = Integer.parseInt(scanner.nextLine());
  12. int percentDiscount = Integer.parseInt(scanner.nextLine());
  13.  
  14. // • Пакет химикали - 5.80 лв.
  15. // • Пакет маркери - 7.20 лв.
  16. // • Препарат - 1.20 лв (за литър)
  17.  
  18. double priceAllPens = pensCount * 5.80;
  19. double priceAllMarkers = markersCount * 7.20;
  20. double priceAllDetergent = litersDetergent * 1.20;
  21.  
  22. double totalSum = priceAllPens + priceAllMarkers + priceAllDetergent;
  23.  
  24. double discount = totalSum * (percentDiscount / 100.0);
  25.  
  26. double sumWithDiscount = totalSum - discount;
  27.  
  28. System.out.println(sumWithDiscount);
  29. }
  30. }
  31.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement