Advertisement
desislava_topuzakova

01. Supplies for School

Mar 31st, 2020
242
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.93 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class SuppliesForSchool_01 {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner(System.in);
  6.  
  7.         int countPens= Integer.parseInt(scanner.nextLine());
  8.         int countMarkers = Integer.parseInt(scanner.nextLine());
  9.         double litersCleaner = Double.parseDouble(scanner.nextLine());
  10.         int discount = Integer.parseInt(scanner.nextLine());
  11.         //Пакет химикали - 5.80 лв
  12.         //Пакет маркери - 7.20 лв
  13.         //Препарат - 1.20 лв (за литър)
  14.         double pricePens = countPens * 5.80;
  15.         double priceMarkers = countMarkers * 7.20;
  16.         double priceCleaner = litersCleaner * 1.20;
  17.  
  18.         double totalPrice = pricePens + priceMarkers + priceCleaner;
  19.         double priceWithDiscount = totalPrice - (totalPrice * discount) / 100;
  20.  
  21.         System.out.printf("%.3f", priceWithDiscount);
  22.  
  23.     }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement