galinyotsev123

ProgBasicsExam16December2018-E03sushiTime

Dec 30th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.99 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class E03sushiTime {
  4. public static void main(String[] args) {
  5. Scanner scanner = new Scanner(System.in);
  6.  
  7. String sushi = scanner.nextLine();
  8. String restaurant = scanner.nextLine();
  9. double quantity = Double.parseDouble(scanner.nextLine());
  10. String symbol = scanner.nextLine();
  11.  
  12.  
  13. double sum = 0;
  14. double total = 0;
  15.  
  16. if(!(restaurant.equalsIgnoreCase("Sushi Zone") || (restaurant.equalsIgnoreCase("Sushi Time")
  17. || (restaurant.equalsIgnoreCase("Sushi Bar") || restaurant.equalsIgnoreCase("Asian Pub"))))) {
  18. System.out.printf("%s is invalid restaurant!", restaurant);
  19. return;
  20. }
  21.  
  22. if (sushi.equalsIgnoreCase("sashimi")){
  23. if(restaurant.equalsIgnoreCase("Sushi Zone")){
  24. sum = 4.99;
  25. }
  26. else if(restaurant.equalsIgnoreCase("Sushi Time")){
  27. sum = 5.49;
  28. }
  29. else if(restaurant.equalsIgnoreCase("Sushi Bar")){
  30. sum = 5.25;
  31. }
  32. else if(restaurant.equalsIgnoreCase("Asian Pub")){
  33. sum = 4.50;
  34. }
  35. }
  36.  
  37. if (sushi.equalsIgnoreCase("maki")){
  38. if(restaurant.equalsIgnoreCase("Sushi Zone")){
  39. sum = 5.29;
  40. }
  41. else if(restaurant.equalsIgnoreCase("Sushi Time")){
  42. sum = 4.69;
  43. }
  44. else if(restaurant.equalsIgnoreCase("Sushi Bar")){
  45. sum = 5.55;
  46. }
  47. else if(restaurant.equalsIgnoreCase("Asian Pub")){
  48. sum = 4.80;
  49. }
  50. }
  51.  
  52. if (sushi.equalsIgnoreCase("uramaki")){
  53. if(restaurant.equalsIgnoreCase("Sushi Zone")){
  54. sum = 5.99;
  55. }
  56. else if(restaurant.equalsIgnoreCase("Sushi Time")){
  57. sum = 4.49;
  58. }
  59. else if(restaurant.equalsIgnoreCase("Sushi Bar")){
  60. sum = 6.25;
  61. }
  62. else if(restaurant.equalsIgnoreCase("Asian Pub")){
  63. sum = 5.50;
  64. }
  65. }
  66.  
  67. if (sushi.equalsIgnoreCase("temaki")){
  68. if(restaurant.equalsIgnoreCase("Sushi Zone")){
  69. sum = 4.29;
  70. }
  71. else if(restaurant.equalsIgnoreCase("Sushi Time")){
  72. sum = 5.19;
  73. }
  74. else if(restaurant.equalsIgnoreCase("Sushi Bar")){
  75. sum = 4.75;
  76. }
  77. else if(restaurant.equalsIgnoreCase("Asian Pub")){
  78. sum = 5.50;
  79. }
  80. }
  81.  
  82. total = sum * quantity;
  83. double totalPlusDelivery = 0;
  84.  
  85. if (symbol.equalsIgnoreCase("Y")){
  86. totalPlusDelivery = total * 1.20;
  87. }
  88. else if (symbol.equalsIgnoreCase("N")){
  89. totalPlusDelivery = total;
  90. }
  91.  
  92.  
  93. System.out.printf("Total price: %.0f lv.",Math.ceil(totalPlusDelivery));
  94.  
  95.  
  96. }
  97. }
Advertisement
Add Comment
Please, Sign In to add comment