1. Place all the Menus in separate Methods. 2. Place computations in separate Methods and call the methods once needed.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

import java.util.Scanner;
public class Resto{

public static void main (String[] args){

//initialization and declaration

Scanner input = new Scanner (System.in);
String message;
int Option1;
int Option2;
int Quantity;
int TotalBill;
int Cash;
int Change;
final int SPECIALS = 1;
final int BREAKFAST = 2;
final int LUNCH = 3;
final int SANDWICHES = 4;
final int DRINKS = 5;
final int DESSERTS = 6;

//For the Special, Breakfast, Lunch Options
final int Meals1 = 11;
final int Meals2 = 12;
final int Meals3 = 13;
final int Meals4 = 14;

//First menu and First Option
System.out.println("\t Welcome to My Kitchen ");
System.out.println("\t\t SPECIALS");
System.out.println("\t\t [2] BREAKFAST MEALS");
System.out.println("\t\t [3] LUNCH MEALS");
System.out.println("\t\t [4] SANDWICHES");
System.out.println("\t\t [5] DRINKS");
System.out.println("\t\t [6] DESSERTS");
System.out.println("\t\t [0] EXIT");

System.out.print("Choose an option ");
Option1 = input.nextInt();

//first switch case statements

switch(Option1){

case (SPECIALS):
message = "**********[SPECIALS]**********\n\t [11] Baked Macaroni \n\t [12] Baked Spaghetti \n\t [13] Beef with Vegetables \n\t [14] Mongolian BBQ \n\n\t [0] Exit";
break;
case (BREAKFAST):
message = "**********[BREAKFAST MEALS]**********\n\t [11] Egg & Bacon with Rice \n\t [12] Egg & Longganisa with Rice \n\t [13] Omelette \n\t [14] Pancake BBQ \n\n\t [0] Exit";
break;
case (LUNCH):
message = "**********[LUNCH MEALS]**********\n\t [11] Beef Ribs \n\t [12] Burger Steak \n\t [13] Fried Chicken Fillet \n\t [14] Pork BBQ \n\n\t [0] Exit";
break;
case (SANDWICHES):
message = "**********[SANDWICHES]**********\n\t [1] Clubhouse Sandwich \n\t [2] Cheeseburger \n\t [3] Grilled Cheese Sandwich \n\t [4] Ham & Cheese Sandwich \n\n\t [0] Exit";
break;
case (DRINKS):
message = "**********[DRINKS]**********\n\t [1] Coke \n\t [2] Sprite \n\t [3] RootBeer \n\n\t [0] Exit";
break;
case (DESSERTS):
message = "**********[DESSERTS]**********\n\t [1] Fruit Salad \n\t [2] IceCream \n\t [3] Cheesecake \n\n\t [0] Exit";
break;
default:
message = "Thank You and come again";
break;
}
System.out.println(message);

//2nd Options and 2nd switch case statements

System.out.print("Choose an option: ");
Option2 = input.nextInt();

switch (Option2){

case (SPECIALS):
message = "**********[Choices]**********\n\t [11] Small \n\t [12] Medium \n\t [13] Large \n\t [14] Extra Large \n\n\t [0] Exit";
break;
case (BREAKFAST):
message = "**********[Choices]**********\n\t [11] Small \n\t [12] Medium \n\t [13] Large \n\t [14] Extra Large \n\n\t [0] Exit";
break;
case (LUNCH):
message = "**********[Choices]**********\n\t [11] Small \n\t [12] Medium \n\t [13] Large \n\t [14] Extra Large \n\n\t [0] Exit";
break;
case (SANDWICHES):
message = "**********[Choices]**********\n\t [11] Small \n\t [12] Medium \n\t [13] Large \n\t [14] Extra Large \n\n\t [0] Exit";
break;
case (DRINKS):
message = "**********[Choices]**********\n\t [11] Small \n\t [12] Medium \n\t [13] Large \n\t [14] Extra Large \n\n\t [0] Exit";
break;
case (DESSERTS):
message = "**********[Choices]**********\n\t [11] Small \n\t [12] Medium \n\t [13] Large \n\t [14] Extra Large \n\n\t [0] Exit";
break;
case (Meals1):
message = "**********[Choices]**********\n\t [11] Small \n\t [12] Medium \n\t [13] Large \n\t [14] Extra Large \n\n\t [0] Exit";
break;
case (Meals2):
message = "**********[Choices]**********\n\t [11] Small \n\t [12] Medium \n\t [13] Large \n\t [14] Extra Large \n\n\t [0] Exit";
break;
case (Meals3):
message = "**********[Choices]**********\n\t [11] Small \n\t [12] Medium \n\t [13] Large \n\t [14] Extra Large \n\n\t [0] Exit";
break;
case (Meals4):
message = "**********[Choices]**********\n\t [11] Small \n\t [12] Medium \n\t [13] Large \n\t [14] Extra Large \n\n\t [0] Exit";
break;
default:
message = "Thank you and come again";
break;

}

System.out.print(message);
System.out.print("Choose an option: ");
Option1= input.nextInt();

//Computing for the prices and giving change
System.out.print("Quantity: ");
Quantity = input.nextInt();
TotalBill = Quantity * 50;
System.out.println("Total Bill is "+TotalBill);
System.out.print("Cash: ");
Cash = input.nextInt();
Change = Cash - TotalBill;

//if statement
if (Cash < TotalBill)
System.out.print ("Not enough payment");
else
System.out.println ("Change is: "+Change);
//Outro
System.out.println("Thank You and come again at My Kitchen!");

}
}

1. Place all the Menus in separate Methods.
2. Place computations in separate Methods and call the methods once needed.
3. Enable looping of the program to:
a. Return to specific Menu (e.g. Meal Menu, Drinks Menu, Pasta Menu, etc.)
b. Return to the Main Menu from any point within the program
c. Let the program repeat until the customer doesn't want to order anymore.
Please note: Menu structures and variables need to be labeled with intuitive identifier
names intended for their purpose.
Transcribed Image Text:1. Place all the Menus in separate Methods. 2. Place computations in separate Methods and call the methods once needed. 3. Enable looping of the program to: a. Return to specific Menu (e.g. Meal Menu, Drinks Menu, Pasta Menu, etc.) b. Return to the Main Menu from any point within the program c. Let the program repeat until the customer doesn't want to order anymore. Please note: Menu structures and variables need to be labeled with intuitive identifier names intended for their purpose.
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY