Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Design a restaurant ordering system using Java. Here is the menu for the restaur

ID: 3705428 • Letter: D

Question

Design a restaurant ordering system using Java.

Here is the menu for the restaurant.

Soups and Salads:

Tomato --------------------$5.00

Chicken Tortilla ---------$6.50

Seafood Bisque ---------$9.50

House ---------------------$6.00

Caesar ---------------------$8.00

Appetizers:

Soft Pretzel Sticks -------$5.00

Spicy Tuna------------------$7.50

Guacamole ----------------$5.00

Burgers

Main Street ----------------$12.00

Southwest ------------------$14.00

Original------------------------$11.00

Steakhouse -----------------$18.00

What you need to do:

1. Ask the number of people in the party

2. Calculate the total per person including 7% tax based on their selection.

3. Display the total for EACH person

Explanation / Answer

import java.util.*;

class Restaurant
{
public static void main (String[] args)
{
  Scanner input = new Scanner(System.in);
  double total = 0;
  int foodItem,mainMenu;
  
  System.out.println("Enter the number of people in the party : ");
  int persons = input.nextInt();
  
  for(int i = 0;i< persons;i++)
  {
  
  System.out.println("Select food item <1.Soups and Salads 2.Appetizers 3.Burgers>");
  
  mainMenu = input.nextInt();
  
  switch(mainMenu)
  {
  case 1:
  System.out.println("Enter the Soups and Salads");
  System.out.println("1.Tomato --------------------$5.00");
  System.out.println("2.Chicken Tortilla ---------$6.50");
  System.out.println("3.Seafood Bisque ---------$9.50");
  System.out.println("4.House ---------------------$6.00");
  System.out.println("5.Caesar ---------------------$8.00");
  foodItem = input.nextInt();
  switch(foodItem)
  {
  case 1: total = total + 5.00;
   break;
  case 2: total = total + 6.50;
   break;
  case 3: total = total + 9.50;
   break;
  case 4: total = total + 6.00;
   break;
  case 5: total = total + 8.00;
   break;
  default: System.out.println("Invalid food item ");
   break;
  }
  case 2:
  System.out.println("Enter the Appetizers:");
  System.out.println("1.Soft Pretzel Sticks -------$5.00");
  System.out.println("2.Spicy Tuna------------------$7.50");
  System.out.println("3.Guacamole ----------------$5.00");
  foodItem = input.nextInt();
  switch(foodItem)
  {
  case 1: total = total + 5.00;
   break;
  case 2: total = total + 7.50;
   break;
  case 3: total = total + 5.00;
   break;
  default: System.out.println("Invalid food item ");
   break;
  }
  case 3:
  System.out.println("Enter the Burgers");
  System.out.println("1.Main Street ----------------$12.00");
  System.out.println("2.Southwest ------------------$14.00");
  System.out.println("3.Original------------------------$11.00");
  System.out.println("4.Steakhouse -----------------$18.00");
  foodItem = input.nextInt();
  switch(foodItem)
  {
  case 1: total = total + 12.00;
   break;
  case 2: total = total + 14.00;
   break;
  case 3: total = total + 11.00;
   break;
  case 4: total = total + 18.00;
   break;
  default: System.out.println("Invalid food item ");
   break;
  }
  
  default: System.out.println("Invalid Menu");
   break;
  }
  }
  total = total +total*0.07;
  System.out.printf("Total after tax for party : $%.2f",total);
  System.out.printf(" Total after tax for each person : $%.2f",total/persons);
}
}

Output:

Enter the number of people in the party :3
Select food item <1.Soups and Salads
2.Appetizers
3.Burgers>


Enter the Soups and Salads
1.Tomato --------------------$5.00
2.Chicken Tortilla ---------$6.50
3.Seafood Bisque ---------$9.50
4.House ---------------------$6.00
5.Caesar ---------------------$8.00
Enter the Appetizers:
1.Soft Pretzel Sticks -------$5.00
2.Spicy Tuna------------------$7.50
3.Guacamole ----------------$5.00
Enter the Burgers
1.Main Street ----------------$12.00
2.Southwest ------------------$14.00
3.Original------------------------$11.00
4.Steakhouse -----------------$18.00
Invalid Menu
Select food item <1.Soups and Salads
2.Appetizers
3.Burgers>
Enter the Burgers
1.Main Street ----------------$12.00
2.Southwest ------------------$14.00
3.Original------------------------$11.00
4.Steakhouse -----------------$18.00
Invalid Menu
Select food item <1.Soups and Salads
2.Appetizers
3.Burgers>
Enter the Soups and Salads
1.Tomato --------------------$5.00
2.Chicken Tortilla ---------$6.50
3.Seafood Bisque ---------$9.50
4.House ---------------------$6.00
5.Caesar ---------------------$8.00
Enter the Appetizers:
1.Soft Pretzel Sticks -------$5.00
2.Spicy Tuna------------------$7.50
3.Guacamole ----------------$5.00
Enter the Burgers
1.Main Street ----------------$12.00
2.Southwest ------------------$14.00
3.Original------------------------$11.00
4.Steakhouse -----------------$18.00

Total after tax for party : $80.25
Total after tax for each person : $26.75

Do ask if any doubt. Please upvote.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote