Advertisement
GabrielHr00

05. Supplies for School

May 14th, 2023
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.77 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.         int pensCount = Integer.parseInt(scanner.nextLine());
  7.         int markersCount = Integer.parseInt(scanner.nextLine());
  8.         int detergentLiters = Integer.parseInt(scanner.nextLine());
  9.         int discountPercent = Integer.parseInt(scanner.nextLine());
  10.  
  11.         double pensSum = pensCount * 5.80;
  12.         double markersSum = markersCount * 7.20;
  13.         double detergentsSum = detergentLiters * 1.20;
  14.  
  15.         double totalSum = pensSum + markersSum + detergentsSum;
  16.  
  17.         // 100 * 20% = 20
  18.         totalSum = totalSum - (totalSum * discountPercent/100);
  19.  
  20.         System.out.println(totalSum);
  21.     }
  22. }
  23.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement