Question

Your assignment is to create a restaurant ordering system where the cashier can create the menu and then take in the order and display the order back to the customerProgram Specifications Level 1 - Create a menu and make a 1 item order (max grade 60/100): a) User may enter any number of memenu items array of String numMenuItems int startover - char input - Scanner Main method: 1. Greet the customer 2. Get number

Sample Execution – Level 1
Welcome to your Menu Creation system.
How many items would you like to have on your menu? 2
Create your menu!
Enter item #1: Coffee
Enter item #2: Tea
This is the menu:
Coffee
Tea
What would you like to order? Cake
That isn’t on our menu.
What would you like to order? Coffee
Thank you for your order. Would you like to start over? n
Goodbye!

Sample Execution – Level 2
Welcome to your Menu Creation system.
How many items would you like to have on your menu? 3
Create your menu!
Enter item #1: Coffee
Enter item #2: Tea
Enter item #3: Pop
May I take your order?
This is the menu:
Coffee
Tea
Pop
How many items would you like to order? 2
What is choice #1: Cake
That isn’t on our menu.
What is choice #1: Tea
What is choice #2: Cake
That isn’t on our menu.
What is choice #2: Coffee
This is your order:
Tea
Coffee
Thank you for your order. Would you like to start over? n
Goodbye!

Please Use simple code. Like, I post second screenshot above. Use Eclipse application of Java. Like menu as array or string.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Execution Steps:

Save it with the name Resturant.java

import java.util.Scanner;

public class Resturant{
   static int s=0;
   public static void main(String[] args) {
      
       int numMenuItems;
      
       char startOver='y';
       String item;
       int levelchoice;
       Scanner sc=new Scanner(System.in);
       System.out.println("Type of Level Used"+"\n"+" 1. Level 1"+"\n"+" 2. Level 2");

       System.out.println("Enter the level");
       levelchoice=sc.nextInt();
       switch(levelchoice) {
       case 1:
               do {
                   int flag=0;
                   System.out.println("Welcome to your Menu Creation system");
                   System.out.print("How many items would you like to have on your menu?");
                   numMenuItems=sc.nextInt();
                   String menuitems[]=new String[numMenuItems];
                   System.out.println("Create your menu!");
              
                   for(int i=0;i<numMenuItems;i++)
                   {  
                  
                   System.out.println("Enter item #"+(i+1)+":");
                   menuitems[i]=sc.next();
                   }
                   System.out.println("This is the menu:");
                   for(int i=0;i<menuitems.length;i++)
                   {  
                   System.out.println(menuitems[i]);
                   }
              
                   while(flag!=1) {
                       System.out.print("What would you like to order?");
                       item=sc.next();
                       for(int i=0;i<menuitems.length;i++)
                       {  
                           if(item.equals(menuitems[i]))
                           {
                               flag=1;
                               break;
                           }
                           else {
                               flag=0;
                           }
              
                       }
                       if(flag==1)
                       {
                           System.out.println("Thank you for your order. Would you like to start over?");
                           startOver=sc.next().charAt(0);
                           if(startOver=='n'){
                               System.out.println("Goodbye!");
                               break;
                           }
                       }
                       else
                       {
                           System.out.println("That isn’t on our menu.");
              
                       }
          
          
                   }
               }while(startOver=='y');
          
       case 2:
           do {
               int flag=0;
               System.out.println("Welcome to your Menu Creation system");
               System.out.print("How many items would you like to have on your menu?");
               numMenuItems=sc.nextInt();
               String menuitems[]=new String[numMenuItems];
               System.out.println("Create your menu!");
          
               for(int i=0;i<numMenuItems;i++)
               {  
              
               System.out.println("Enter item #"+(i+1)+":");
               menuitems[i]=sc.next();
               }
               System.out.println("May I take your order?");
               System.out.println("This is the menu:");
              
               for(int i=0;i<menuitems.length;i++)
               {  
               System.out.println(menuitems[i]);
               }
               System.out.println("How many items would you like to order?");
               int itemno=sc.nextInt();
               int l=0;
               String menucollection[]=new String[itemno];
               for(int j=0;j<itemno;j++) {
                   int p=0;
                   s=j;
           while(flag!=1) {
                   System.out.print("What is choice #"+(s+1)+":");
                   item=sc.next();
                  
                   for(int i=0;i<menuitems.length;i++)
                   {  
                       if(item.equals(menuitems[i]))
                       {
                           menucollection[l]=item;
                           l++;
                           flag=1;
                          
                       }
                      
          
                   }
                   if(flag==1)
                   {
                       p=1;
                       flag=0;
                       s++;
                   }
                   else
                   {
                      
                       System.out.println("That isn’t on our menu.");
                      
                       break;
                   }
           }
                   if(p==1)
                   {
                      
                      
                       System.out.println("This is your order: ");
                       for(int i=0;i<menucollection.length&&menucollection[i]!=null;i++)
                       {
                           System.out.println(menucollection[i]);
                       }
                       System.out.println("Thank you for your order. Would you like to start over?");
                       startOver=sc.next().charAt(0);
                       if(startOver=='n'){
                           System.out.println("Goodbye!");
                           break;
                       }
                   }
              
               }
           }while(startOver=='y');
      
          
}   
}
  
}

Output

Type of Level Used
1. Level 1
2. Level 2
Enter the level
2
Welcome to your Menu Creation system
How many items would you like to have on your menu?2
Create your menu!
Enter item #1:
ee
Enter item #2:
ff
May I take your order?
This is the menu:
ee
ff
How many items would you like to order?
2
What is choice #1:ee
What is choice #2:ff
What is choice #3:gg
That isn’t on our menu.
This is your order:
ee
ff
Thank you for your order. Would you like to start over?
n
Goodbye!

Type of Level Used
1. Level 1
2. Level 2
Enter the level
1
Welcome to your Menu Creation system
How many items would you like to have on your menu?2
Create your menu!
Enter item #1:
dd
Enter item #2:
ff
This is the menu:
dd
ff
What would you like to order?dd
Thank you for your order. Would you like to start over?

Add a comment
Know the answer?
Add Answer to:
Your assignment is to create a restaurant ordering system where the cashier can create the menu...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Sample Execution – Level 3 Welcome to your Menu Creation system. How many items would you...

    Sample Execution – Level 3 Welcome to your Menu Creation system. How many items would you like to have on your menu? 2 Create your menu! Enter item #1: Coffee Enter the number of toppings: 2 Enter topping #1: Whipped Cream Enter topping #2: Cinnamon Enter item #2: Tea Enter the number of toppings: 2 Enter topping #1: Milk Enter topping #2: Sugar May I take your order? This is the menu: Coffee Tea Pop How many items would you...

  • In C++ Programming Write a program in Restaurant.cpp to help a local restaurant automate its breakfast...

    In C++ Programming Write a program in Restaurant.cpp to help a local restaurant automate its breakfast billing system. The program should do the following: Show the customer the different breakfast items offered by the restaurant. Allow the customer to select more than one item from the menu. Calculate and print the bill. Assume that the restaurant offers the following breakfast items (the price of each item is shown to the right of the item): Name Price Egg (cooked to order)...

  • Here is the assignment: Fibonacci or Prime number iterator: Design a menu driven program that performs...

    Here is the assignment: Fibonacci or Prime number iterator: Design a menu driven program that performs the user’s choice of the following functions the program exits should also be a user’s choice. Menu Item 1: Fibonacci number iterator, here you are to define an iterator class named FibonacciIterator for iterating Fibonacci numbers. The constructor takes an argument that specifies the limit of the maximum Fibonacci number. For example, prompt the user for size, use the size to call FibonacciIterator(“user input”)...

  • In this same program I need to create a new method called “int findItem(String[] shoppingList, String...

    In this same program I need to create a new method called “int findItem(String[] shoppingList, String item)” that takes an array of strings that is a shopping list and a string for an item name and searches through the “shoppingList” array for find if the “item” exists. If it does exist print a confirmation and return the item index. If the item does not exist in the array print a failure message and return -1. import java.util.Scanner; public class ShoppingList...

  • Create a program to help some local coffee shops manage their menus Requirements The class contai...

    program is C# Create a program to help some local coffee shops manage their menus Requirements The class contains: 1) A method called defaultMenu that returns a String list and has no parameters. When called, the method returns a string list containing the following elements: {"Coffee", "Americano", Cappuccino" A method called custom Menu that returns a String list and has an int parameter. When called, the method will create a new string list, then ask the user for items to...

  • #include <iostream> #include <iomanip> #include <vector> #include <string> using namespace std; struct menuItemType { string menuItem;...

    #include <iostream> #include <iomanip> #include <vector> #include <string> using namespace std; struct menuItemType { string menuItem; double menuPrice; }; void getData(menuItemType menuList[]); void showMenu(menuItemType menuList[], int x); void printCheck(menuItemType menuList[], int menuOrder[], int x); int main() { const int menuItems = 8; menuItemType menuList[menuItems]; int menuOrder[menuItems] = {0}; int orderChoice = 0; bool ordering = true; int count = 0; getData(menuList); showMenu(menuList, menuItems); while(ordering) { cout << "Enter the number for the item you would\n" << "like to order, or...

  • 1) Create a main() method with a switch statement that calls either a sum() OR factorial()...

    1) Create a main() method with a switch statement that calls either a sum() OR factorial() method, depending on what selection the user of the program makes - ask the user to enter a selection (with System.out.println()), create a Scanner then read the user's input with a call to Scanner next(), then call the appropriate method in a switch (the String that was read from the call to Scanner.next() should be what you use as your switch condition). 2) Create...

  • Assignment Write a menu-driven C++ program to manage a class roster of student names that can...

    Assignment Write a menu-driven C++ program to manage a class roster of student names that can grow and shrink dynamically. It should work something like this (user input highlighted in blue): Array size: 0, capacity: 2 MENU A Add a student D Delete a student L List all students Q Quit ...your choice: a[ENTER] Enter the student name to add: Jonas-Gunnar Iversen[ENTER] Array size: 1, capacity: 2 MENU A Add a student D Delete a student L List all students...

  • eclipse java Oxygen Design a self-service fast food menu. Name your class FastFood. Create a test...

    eclipse java Oxygen Design a self-service fast food menu. Name your class FastFood. Create a test class based on the examples from chapter 4. Create a program to do the following. When you set up the program, save the java file to a folder named Chapter 04 Program. Console Welcome to the fast food order menu How may I help you Please place your order: НННН Please place your order Your order Your subtotal: $e.00 $e.00 Continue? (y/n): Y Please...

  • Write a menu based program implementing the following functions: (0) Write a function called displayMenu that...

    Write a menu based program implementing the following functions: (0) Write a function called displayMenu that does not take any parameters, but returns an integer representing your user's menu choice. Your program's main function should only comprise of the following: a do/while loop with the displayMenu function call inside the loop body switch/case, or if/else if/ ... for handling the calls of the functions based on the menu choice selected in displayMenu. the do/while loop should always continue as long...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT