Advertisement
SUni2020

03.SushiTime

Mar 27th, 2020
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.53 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class SushiTime_03 {
  4. public static void main(String[] args) {
  5. Scanner scanner = new Scanner(System.in);
  6.  
  7. String sushiType = scanner.nextLine();
  8. String restaurantName = scanner.nextLine();
  9. int count = Integer.parseInt(scanner.nextLine());
  10. char delivery = scanner.nextLine().charAt(0);
  11.  
  12. double price = 0;
  13. switch (restaurantName)
  14. {
  15. case "Sushi Zone":
  16. switch (sushiType)
  17. {
  18. case "sashimi": price = 4.99; break;
  19. case "maki": price = 5.29; break;
  20. case "uramaki": price = 5.99; break;
  21. case "temaki": price = 4.29; break;
  22.  
  23. }
  24. break;
  25. case "Sushi Time":
  26. switch (sushiType)
  27. {
  28. case "sashimi": price = 5.49;
  29. break;
  30. case "maki": price = 4.69;
  31. break;
  32. case "uramaki": price = 4.49;
  33. break;
  34. case "temaki": price = 5.19;
  35. break;
  36.  
  37. }
  38. break;
  39. case "Sushi Bar":
  40. switch (sushiType)
  41. {
  42. case "sashimi": price = 5.25;
  43. break;
  44. case "maki": price = 5.55;
  45. break;
  46. case "uramaki": price = 6.25;
  47. break;
  48. case "temaki": price = 4.75;
  49. break;
  50.  
  51. }
  52. break;
  53. case "Asian Pub":
  54. switch (sushiType)
  55. {
  56. case "sashimi": price = 4.50;
  57. break;
  58. case "maki": price = 4.80;
  59. break;
  60. case "uramaki": price = 5.50;
  61. break;
  62. case "temaki": price = 5.50;
  63. break;
  64.  
  65. }
  66. break;
  67. default:
  68. System.out.printf("%s is invalid restaurant!", restaurantName);
  69. return;
  70. }
  71.  
  72. double totalPrice = price * count;
  73.  
  74. if (delivery == 'Y')
  75. {
  76. totalPrice = totalPrice + totalPrice * 0.20; //1.2 * totalPrice
  77. }
  78. System.out.printf("Total price: %.0f lv.",Math.ceil(totalPrice));
  79. }
  80. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement