Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class E03sushiTime {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- String sushi = scanner.nextLine();
- String restaurant = scanner.nextLine();
- double quantity = Double.parseDouble(scanner.nextLine());
- String symbol = scanner.nextLine();
- double sum = 0;
- double total = 0;
- if(!(restaurant.equalsIgnoreCase("Sushi Zone") || (restaurant.equalsIgnoreCase("Sushi Time")
- || (restaurant.equalsIgnoreCase("Sushi Bar") || restaurant.equalsIgnoreCase("Asian Pub"))))) {
- System.out.printf("%s is invalid restaurant!", restaurant);
- return;
- }
- if (sushi.equalsIgnoreCase("sashimi")){
- if(restaurant.equalsIgnoreCase("Sushi Zone")){
- sum = 4.99;
- }
- else if(restaurant.equalsIgnoreCase("Sushi Time")){
- sum = 5.49;
- }
- else if(restaurant.equalsIgnoreCase("Sushi Bar")){
- sum = 5.25;
- }
- else if(restaurant.equalsIgnoreCase("Asian Pub")){
- sum = 4.50;
- }
- }
- if (sushi.equalsIgnoreCase("maki")){
- if(restaurant.equalsIgnoreCase("Sushi Zone")){
- sum = 5.29;
- }
- else if(restaurant.equalsIgnoreCase("Sushi Time")){
- sum = 4.69;
- }
- else if(restaurant.equalsIgnoreCase("Sushi Bar")){
- sum = 5.55;
- }
- else if(restaurant.equalsIgnoreCase("Asian Pub")){
- sum = 4.80;
- }
- }
- if (sushi.equalsIgnoreCase("uramaki")){
- if(restaurant.equalsIgnoreCase("Sushi Zone")){
- sum = 5.99;
- }
- else if(restaurant.equalsIgnoreCase("Sushi Time")){
- sum = 4.49;
- }
- else if(restaurant.equalsIgnoreCase("Sushi Bar")){
- sum = 6.25;
- }
- else if(restaurant.equalsIgnoreCase("Asian Pub")){
- sum = 5.50;
- }
- }
- if (sushi.equalsIgnoreCase("temaki")){
- if(restaurant.equalsIgnoreCase("Sushi Zone")){
- sum = 4.29;
- }
- else if(restaurant.equalsIgnoreCase("Sushi Time")){
- sum = 5.19;
- }
- else if(restaurant.equalsIgnoreCase("Sushi Bar")){
- sum = 4.75;
- }
- else if(restaurant.equalsIgnoreCase("Asian Pub")){
- sum = 5.50;
- }
- }
- total = sum * quantity;
- double totalPlusDelivery = 0;
- if (symbol.equalsIgnoreCase("Y")){
- totalPlusDelivery = total * 1.20;
- }
- else if (symbol.equalsIgnoreCase("N")){
- totalPlusDelivery = total;
- }
- System.out.printf("Total price: %.0f lv.",Math.ceil(totalPlusDelivery));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment