Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class SushiTime_03 {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- String sushiType = scanner.nextLine();
- String restaurantName = scanner.nextLine();
- int count = Integer.parseInt(scanner.nextLine());
- char delivery = scanner.nextLine().charAt(0);
- double price = 0;
- switch (restaurantName)
- {
- case "Sushi Zone":
- switch (sushiType)
- {
- case "sashimi": price = 4.99; break;
- case "maki": price = 5.29; break;
- case "uramaki": price = 5.99; break;
- case "temaki": price = 4.29; break;
- }
- break;
- case "Sushi Time":
- switch (sushiType)
- {
- case "sashimi": price = 5.49;
- break;
- case "maki": price = 4.69;
- break;
- case "uramaki": price = 4.49;
- break;
- case "temaki": price = 5.19;
- break;
- }
- break;
- case "Sushi Bar":
- switch (sushiType)
- {
- case "sashimi": price = 5.25;
- break;
- case "maki": price = 5.55;
- break;
- case "uramaki": price = 6.25;
- break;
- case "temaki": price = 4.75;
- break;
- }
- break;
- case "Asian Pub":
- switch (sushiType)
- {
- case "sashimi": price = 4.50;
- break;
- case "maki": price = 4.80;
- break;
- case "uramaki": price = 5.50;
- break;
- case "temaki": price = 5.50;
- break;
- }
- break;
- default:
- System.out.printf("%s is invalid restaurant!", restaurantName);
- return;
- }
- double totalPrice = price * count;
- if (delivery == 'Y')
- {
- totalPrice = totalPrice + totalPrice * 0.20; //1.2 * totalPrice
- }
- System.out.printf("Total price: %.0f lv.",Math.ceil(totalPrice));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement