Advertisement
Guest User

Untitled

a guest
Feb 19th, 2019
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.02 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Main {
  4.     public static void main(String[] args) {
  5.         Scanner console = new Scanner(System.in);
  6.  
  7.         int size = Integer.parseInt(console.nextLine());
  8.         String filling = console.nextLine().toLowerCase();
  9.         int quantity = Integer.parseInt(console.nextLine());
  10.         String decoration = console.nextLine().toLowerCase();
  11.         int fillingQuantity = 1;
  12.         int decorationQuantity = 1;
  13.  
  14.         if (decoration.equals("yes")) {
  15.             decorationQuantity = 5;
  16.         }
  17.         switch (size) {
  18.             case 10:
  19.                 switch (filling) {
  20.                     case "milk cream":
  21.                         fillingQuantity = 15;
  22.                         break;
  23.                     case "cream":
  24.                         fillingQuantity = 10;
  25.                         break;
  26.                     case "chocolate":
  27.                         fillingQuantity = 20;
  28.                         break;
  29.                 }
  30.                 break;
  31.             case 12:
  32.                 switch (filling) {
  33.                     case "milk cream":
  34.                         fillingQuantity = 20;
  35.                         break;
  36.                     case "cream":
  37.                         fillingQuantity = 15;
  38.                         break;
  39.                     case "chocolate":
  40.                         fillingQuantity = 25;
  41.                         break;
  42.                 }
  43.                 break;
  44.             case 16:
  45.                 switch (filling) {
  46.                     case "milk cream":
  47.                         fillingQuantity = 25;
  48.                         break;
  49.                     case "cream":
  50.                         fillingQuantity = 20;
  51.                         break;
  52.                     case "chocolate":
  53.                         fillingQuantity = 30;
  54.                         break;
  55.                 }
  56.                 break;
  57.         }
  58.         double result = fillingQuantity * quantity + decorationQuantity;
  59.         System.out.printf("%.2f", result);
  60.     }
  61. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement