Advertisement
emodev

Sweets

Jan 15th, 2019
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.05 KB | None | 0 0
  1.  import java.util.Scanner;
  2.         public class Ex1ChristmasSweets {
  3.             public static void main(String[] args) {
  4.                 Scanner scanner = new Scanner(System.in);
  5.  
  6.                 double BaklavaPrice = Double.parseDouble(scanner.nextLine());
  7.                 double MuffinsPrice = Double.parseDouble(scanner.nextLine());
  8.                 double ShtolenKg = Double.parseDouble(scanner.nextLine());
  9.                 double CandysKg = Double.parseDouble(scanner.nextLine());
  10.                 int BiscuitsKg = Integer.parseInt(scanner.nextLine());
  11.  
  12.                 double ShtolenPrice = BaklavaPrice+BaklavaPrice*0.60; // или BaklavaPrice * 1.60
  13.                 double ShtolenSum = ShtolenKg*ShtolenPrice;
  14.                 double CandysPrice = MuffinsPrice+MuffinsPrice*0.80;
  15.                 double CandysSum = CandysKg*CandysPrice;
  16.                 double BiscuitsSum = BiscuitsKg*7.50;
  17.  
  18.                 double FinalPrice = (ShtolenSum+CandysSum+BiscuitsSum);
  19.  
  20.                 System.out.printf("%.2f", FinalPrice);
  21.             }
  22.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement