Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class PaintingEggs {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- String typeSweet = scanner.nextLine();
- int count = Integer.parseInt(scanner.nextLine());
- int day = Integer.parseInt(scanner.nextLine());
- double priceForOne = 0;
- if (day<=15)
- {
- switch (typeSweet) {
- case "Cake":
- priceForOne = 24;
- break;
- case "Souffle":
- priceForOne = 6.66;
- break;
- case "Baklava":
- priceForOne = 12.60;
- break;
- }
- }
- else
- {
- switch (typeSweet)
- {
- case "Cake":
- priceForOne = 28.70;
- break;
- case "Souffle":
- priceForOne = 9.80;
- break;
- case "Baklava":
- priceForOne = 16.98;
- break;
- }
- }
- double totalPrice = priceForOne * count;
- if (day<=22)
- {
- if (totalPrice>=100&&totalPrice<=200)
- {
- totalPrice = totalPrice - (totalPrice * 0.15);
- }
- else if (totalPrice > 200)
- {
- totalPrice = totalPrice - (totalPrice * 0.25);
- }
- }
- if (day <= 15)
- {
- totalPrice = totalPrice - (totalPrice * 0.10);
- }
- System.out.printf("%.2f",totalPrice);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment