Advertisement
Kur23

kur1

Apr 18th, 2021
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.92 KB | None | 0 0
  1. package Izpit;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class ChristmasPreparation {
  6.     public static void main(String[] args) {
  7.         Scanner scanner = new Scanner(System.in);
  8.  
  9.         double paperPrice = 5.80;
  10.         double clothPrice = 7.80;
  11.         double gluePrice = 1.20;
  12.  
  13.         int paperRolls = Integer.parseInt(scanner.nextLine());
  14.         int clothRolls = Integer.parseInt(scanner.nextLine());
  15.         double glue = Double.parseDouble(scanner.nextLine());
  16.         int discount = Integer.parseInt(scanner.nextLine());
  17.  
  18.         double pricePaperRolls = paperPrice * paperRolls;
  19.         double priceClothRolls = clothPrice * clothRolls;
  20.         double priceGlue = gluePrice * glue;
  21.         double totalPrice = pricePaperRolls + priceClothRolls + priceGlue;
  22.  
  23.         double priceWithDiscount = totalPrice*(discount/100);
  24.  
  25.         System.out.printf("Money needed: %.3f", priceWithDiscount);
  26.  
  27.  
  28.  
  29.  
  30.     }
  31. }
  32.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement