Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Details The Console You will need to use Scanner to obtain input from the keyboard. You should declare a class constant of type Scanner named
Details The Console You will need to use Scanner to obtain input from the keyboard. You should declare a class constant of type Scanner named CONSOLE at the beginning of your class. You should store new Scanner(System.in) in CONSOLE. See examples in the Week 2 lecture notes of this website. The Menu Your program will assume that there is an employee using the computer and will be the one in charge of the data input. Your program should keep showing the menu until the exit choice is selected. The detail for every option is explained next: . - Exit: When the exit choice is selected, the program shoud display the message "thank you, and good bye." 1 - New customer: This option will ask for the customer's information and will try to assign a table. The table assignation should meet the criteria of a table that is not assigned and has at least the number of required scats. If there is a table the program should display the message "Welcome XXX your table is number Y.". In the latter message the XXX should be replaced by the name of the customer and Y by the table number. The program should also change the arrays of occupied and names with true and the name of the customer. If there is no table, the program should display the message "We are sorry, there is no table available.". 2 - Empty table: Selected when a table has been made available by a customer. Your program should ask for the table that was made available. The table number should be a valid table number and be occupied at that moment. There could be two errors that could be input by the user. One is if the table number is out of the number of tables (length of the array). In that case, the program should show the message "Table number out of range. Please, try again." The second problem would be that the table was not occupied. In that case, the program should show "The table x is not occupied. Please, try again.". Replace x by the table number selected by the user in the last error message. In both error cases, the program should display the menu again. However, if the table is occupied, the program should set false in the specific element of the occupied array. Additionally it should assing an empty string to the element in names array. Nonetheless, if the two conditions are true, the program should show a message as "we hope to have you back soon, xxx." You need to replace xxx with the name of the customer in that table. 3 - Print occupied tables: It will print the occupied tables as shown in the output example. Any other: Display the message "wrong option selected. Please, try again.' Required arrays For your program to work correctly should have at least the following arrays of five elements each. These arrays are storing information of the same table using the element number. seats: Used to store the number of seats per table. In this program it is assumed that it will be filled with the values 2,2,4,5,8. occupied: Used to store which tables are occupied. The five elements should be initialized with false. names: Used to store the name of the customers that made the reservations. The five elements should be initialized with empty string. [80 Points) If your program works correctly for the menu and the four different choices. [20 Points] Five points for each of the following: . If the main method of your program prints "Spring 2020 - CS1083 - Section 00X - Project 2 - written by YOURNAME". . If your submission was a Zip file named project2.zip containing two files called RestaurantFront Desk.java and Restaurant Front DeskOutput.txt. . If your program contains a comment that describes what the program does and contains. o If your program is indented properly. The 80 points of your program working properly are determined as follows: [5 Points] For printing the table's title, initial values, and headers. Be sure to print the dollar signs and percent sign as in the examples, even though these were not entered. . [20 Points] For the menu with validated input. o [5 Points] Correct display o [5 Points Loop until exit is selected o [5 Points) Validate choice selected (only 0 through 3) o [5 Points] The program executes the right action according to the choice selected by the user [20 Points For properly adding a new customer. o [5 Points] Getting info from the user o [5 Points) Verifying that there is a table that could be assigned to the customer o [5 Points] Modifying values in the arrays o [5 Points For showing the message as expected . [20 Points] For properly empty a table. o [5 Points] Validating that it is occupied o [5 points Validating that it is a valid table number o [5 Points) For changing the values in the corresponding arrays o [5 Points] For showing the message as expected . [10 Points] For printing the occupied tables correctly. o [5 Points Printing the right format o [5 Points) Printing only the tables that are occupied [5 Points] For showing the message when exit is selected, interactions consore compler Uutput Findreplace Spring 2020 - CS1083 - Section 00X - Project 3 - written by YOURNAME Restaurant Front Desk Welcome to XYZ restaurant --- MENU ---- 0: Exit 1: New Customer 2: Empty table 3: Print status What is your choice? 1 Customer's name? Laura Por how many people? 6 Welcome Laura your table is the number 4 - MENU ---- 0: Exit 1: New Customer 2: Empty table 3: Print status What is your choice? 1 Customer's name? Sarah Por how many people? 5 Welcome Sarah your table is the number 3 -- MENU ---- 0: Exit 1: New Customer 2: Empty table 3: Print status What is your choice? 3 Table: 3 Seats: 5 Name: Sarah Table: 4 Seats: 8 Name: Laura --- - MENU ----- 0: Exit 1: New Customer 2: Empty table 3: Print status What is your choice? 1 Customer's name? Kenneth For how many people? 5 We are sorry, there is no table available. -=-=- MENU ----- 0: Exit 1: New Customer 3: Empty table 3: Print status What is your choice? 2 What table was made available? 2 The table is not occupied. -- MENU --- 0: Exit 1: New Customer 2: Empty table 3: Print status What is your choice? 2 What table was made available? 4 We hope to have you back soon, Laura --- MENU - 0: Exit 1: New Customer 2: Empty table 3: Print status What is your choice? 3 Table: 3 Seats: 5 Name: Sarah -- MENU ----- 0: Exit 1: New Customer 2: Empty table 3: Print status What is your choice? O Thank you and good bye Details The Console You will need to use Scanner to obtain input from the keyboard. You should declare a class constant of type Scanner named CONSOLE at the beginning of your class. You should store new Scanner(System.in) in CONSOLE. See examples in the Week 2 lecture notes of this website. The Menu Your program will assume that there is an employee using the computer and will be the one in charge of the data input. Your program should keep showing the menu until the exit choice is selected. The detail for every option is explained next: . - Exit: When the exit choice is selected, the program shoud display the message "thank you, and good bye." 1 - New customer: This option will ask for the customer's information and will try to assign a table. The table assignation should meet the criteria of a table that is not assigned and has at least the number of required scats. If there is a table the program should display the message "Welcome XXX your table is number Y.". In the latter message the XXX should be replaced by the name of the customer and Y by the table number. The program should also change the arrays of occupied and names with true and the name of the customer. If there is no table, the program should display the message "We are sorry, there is no table available.". 2 - Empty table: Selected when a table has been made available by a customer. Your program should ask for the table that was made available. The table number should be a valid table number and be occupied at that moment. There could be two errors that could be input by the user. One is if the table number is out of the number of tables (length of the array). In that case, the program should show the message "Table number out of range. Please, try again." The second problem would be that the table was not occupied. In that case, the program should show "The table x is not occupied. Please, try again.". Replace x by the table number selected by the user in the last error message. In both error cases, the program should display the menu again. However, if the table is occupied, the program should set false in the specific element of the occupied array. Additionally it should assing an empty string to the element in names array. Nonetheless, if the two conditions are true, the program should show a message as "we hope to have you back soon, xxx." You need to replace xxx with the name of the customer in that table. 3 - Print occupied tables: It will print the occupied tables as shown in the output example. Any other: Display the message "wrong option selected. Please, try again.' Required arrays For your program to work correctly should have at least the following arrays of five elements each. These arrays are storing information of the same table using the element number. seats: Used to store the number of seats per table. In this program it is assumed that it will be filled with the values 2,2,4,5,8. occupied: Used to store which tables are occupied. The five elements should be initialized with false. names: Used to store the name of the customers that made the reservations. The five elements should be initialized with empty string. [80 Points) If your program works correctly for the menu and the four different choices. [20 Points] Five points for each of the following: . If the main method of your program prints "Spring 2020 - CS1083 - Section 00X - Project 2 - written by YOURNAME". . If your submission was a Zip file named project2.zip containing two files called RestaurantFront Desk.java and Restaurant Front DeskOutput.txt. . If your program contains a comment that describes what the program does and contains. o If your program is indented properly. The 80 points of your program working properly are determined as follows: [5 Points] For printing the table's title, initial values, and headers. Be sure to print the dollar signs and percent sign as in the examples, even though these were not entered. . [20 Points] For the menu with validated input. o [5 Points] Correct display o [5 Points Loop until exit is selected o [5 Points) Validate choice selected (only 0 through 3) o [5 Points] The program executes the right action according to the choice selected by the user [20 Points For properly adding a new customer. o [5 Points] Getting info from the user o [5 Points) Verifying that there is a table that could be assigned to the customer o [5 Points] Modifying values in the arrays o [5 Points For showing the message as expected . [20 Points] For properly empty a table. o [5 Points] Validating that it is occupied o [5 points Validating that it is a valid table number o [5 Points) For changing the values in the corresponding arrays o [5 Points] For showing the message as expected . [10 Points] For printing the occupied tables correctly. o [5 Points Printing the right format o [5 Points) Printing only the tables that are occupied [5 Points] For showing the message when exit is selected, interactions consore compler Uutput Findreplace Spring 2020 - CS1083 - Section 00X - Project 3 - written by YOURNAME Restaurant Front Desk Welcome to XYZ restaurant --- MENU ---- 0: Exit 1: New Customer 2: Empty table 3: Print status What is your choice? 1 Customer's name? Laura Por how many people? 6 Welcome Laura your table is the number 4 - MENU ---- 0: Exit 1: New Customer 2: Empty table 3: Print status What is your choice? 1 Customer's name? Sarah Por how many people? 5 Welcome Sarah your table is the number 3 -- MENU ---- 0: Exit 1: New Customer 2: Empty table 3: Print status What is your choice? 3 Table: 3 Seats: 5 Name: Sarah Table: 4 Seats: 8 Name: Laura --- - MENU ----- 0: Exit 1: New Customer 2: Empty table 3: Print status What is your choice? 1 Customer's name? Kenneth For how many people? 5 We are sorry, there is no table available. -=-=- MENU ----- 0: Exit 1: New Customer 3: Empty table 3: Print status What is your choice? 2 What table was made available? 2 The table is not occupied. -- MENU --- 0: Exit 1: New Customer 2: Empty table 3: Print status What is your choice? 2 What table was made available? 4 We hope to have you back soon, Laura --- MENU - 0: Exit 1: New Customer 2: Empty table 3: Print status What is your choice? 3 Table: 3 Seats: 5 Name: Sarah -- MENU ----- 0: Exit 1: New Customer 2: Empty table 3: Print status What is your choice? O Thank you and good bye
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started