Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Main {
- public static void main(String[] args) {
- Scanner console = new Scanner(System.in);
- int size = Integer.parseInt(console.nextLine());
- String filling = console.nextLine().toLowerCase();
- int quantity = Integer.parseInt(console.nextLine());
- String decoration = console.nextLine().toLowerCase();
- int fillingQuantity = 1;
- int decorationQuantity = 1;
- if (decoration.equals("yes")) {
- decorationQuantity = 5;
- }
- switch (size) {
- case 10:
- switch (filling) {
- case "milk cream":
- fillingQuantity = 15;
- break;
- case "cream":
- fillingQuantity = 10;
- break;
- case "chocolate":
- fillingQuantity = 20;
- break;
- }
- break;
- case 12:
- switch (filling) {
- case "milk cream":
- fillingQuantity = 20;
- break;
- case "cream":
- fillingQuantity = 15;
- break;
- case "chocolate":
- fillingQuantity = 25;
- break;
- }
- break;
- case 16:
- switch (filling) {
- case "milk cream":
- fillingQuantity = 25;
- break;
- case "cream":
- fillingQuantity = 20;
- break;
- case "chocolate":
- fillingQuantity = 30;
- break;
- }
- break;
- }
- double result = fillingQuantity * quantity + decorationQuantity;
- System.out.printf("%.2f", result);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement