Advertisement
Spocoman

05. Supplies for School

Aug 19th, 2024
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.71 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class SuppliesForSchool {
  4.     public static void main(String[] args) {
  5.         double penPrice = 5.80;
  6.         double markerPrice = 7.20;
  7.         double detergentPrice = 1.20;
  8.  
  9.         Scanner scanner = new Scanner(System.in);
  10.         int penCount = Integer.parseInt(scanner.nextLine());
  11.         int markerCount = Integer.parseInt(scanner.nextLine());
  12.         int detergentCount = Integer.parseInt(scanner.nextLine());
  13.         double discount = Double.parseDouble(scanner.nextLine());
  14.  
  15.         double totalPrice = (1 - discount / 100) * (penCount * penPrice + markerCount * markerPrice + detergentCount * detergentPrice);
  16.  
  17.         System.out.println(totalPrice);
  18.     }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement