Advertisement
GabrielHr00

05. Supplies for School

Jan 5th, 2025
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.94 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class SuppliesForSchool {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner(System.in);
  6.  
  7.         int pensCount = Integer.parseInt(scanner.nextLine());
  8.         int markersCount = Integer.parseInt(scanner.nextLine());
  9.         int detergentLiters = Integer.parseInt(scanner.nextLine());
  10.         int percentDiscount = Integer.parseInt(scanner.nextLine());
  11.  
  12.         //•   Пакет химикали - 5.80 лв.
  13.         //•   Пакет маркери - 7.20 лв.
  14.         //•   Препарат - 1.20 лв (за литър)
  15.  
  16.         double pensPrice = pensCount * 5.80;
  17.         double markersPrice = markersCount * 7.20;
  18.         double detergentPrice = detergentLiters * 1.20;
  19.  
  20.         double totalSum = pensPrice + markersPrice + detergentPrice;
  21.         double finalSum = totalSum - (totalSum * (percentDiscount/100.0));
  22.  
  23.         System.out.println(finalSum);
  24.     }
  25. }
  26.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement