Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Functional Requirements For this program, write a C++ program that will implement a customer waiting list that might be used by a restaurant. When a

Functional Requirements For this program, write a C++ program that will implement a customer waiting list that might be used by a restaurant. When a group of people want to be seated in the restaurant, they give their name and group size to the host/hostess and then wait until those in front of them have been seated. Groups are added to the wait list when they either call ahead or when they walk in to the restaurant, and they are always added to the end of the wait list. The system will require that each name used be unique. So when a group is added to the wait list, the system must make sure that no other group is already using that name. When a table with N seats becomes available in the restaurant, the system returns the name of the first group that is in the restaurant and can sit at a table with N seats (i.e. the number of seats at the table is greater than or equal to the number of people in that group). Note that the group selected may not be the first (or even the second or third) group on the wait list, but the first group in the list that the available table can fit. This program will NOT keep track of how many tables the restaurant actually has, nor how many people can sit at each table. The host/hostess is expected to know that information and will enter the appropriate values when needed. Your waiting list system should keep running and taking commands from the user (the host/hostess in this case). The commands used by this system are listed below and are to come from standard input. Your program is to prompt the user for input and display error messages for unknown commands or improperly formatted commands. Each command given must display some information about the command being performed.

a list of groups that are waiting: you are required to make a static array of size 1000 for this list. (in other words, you can not use vectors and other data types, and you are not asked to implement this list as a linked list)

Command Description

q -Quit the program.

?- List the commands used by this program and a brief description of how to use each one.

a -Add the group to the wait list using the given group size and name specifying the group is a walk-in group. The groups information is added to the end of the list. If the name already exists in the wait list, give an error message and do not add the group.

c -Add the group to the wait list using the given group size and name specifying the group as a call-ahead group. The groups information is added to the end of the list. If the name already exists in the wait list, give an error message and do not add the information.

w- Mark the call ahead group using the given name as waiting in the restaurant. If the name does not exist is the wait list or is not a call ahead group, give an error message.

r- Retrieve and remove the first group on the wait list that is waiting in the restaurant and is less than or equal to the table size. Note that first is the group that has been in the wait list the longest.

l - List total number of groups that are in the wait list in front of the group specified by the given name. Also list the size of each group that are in the wait list ahead of the group specified by the given name. If the name does not exist, give an error message.

d- Display the total number of groups in the wait list. Also display the names, group size and in-restaurant status of all groups in the wait list in order from first to last.

Note that and are to be integer values and is a list of characters. The < and > symbols are NOT part of the input but being used to describe the input.

Implementation Requirements

1. Classes: you are required to implement at least the following two classes.

a. Group class

1) information the class maintains: 1. name of the group: a sequence of characters with no space 2. group size: an integer number that is greater than 0 3. in-restaurant status: 2 possible values, call-ahead or walk-in (and you decide how to model this information)

2) actions 1. checkInGroup (or changeGroupStatus): change the status of a group from call-ahead to walk-in.

b. Waitlist class

1) information the class maintains: 1. name of the restaurant: a sequence of characters with no space 2. a list of groups that are waiting: you are required to make a static array of size 1000 for this list. The type of the array could be Group or Group* (for the extra credit). 3. the total number of groups that are waiting: an integer number that is greater than or equal to 0

2) actions 1. setRestaurantName: set the name of the restaurant to a given name. 2. addGroupToList: add a group into the list.

3. displayList: print out the information of all the groups in the waitlist (group name, size, and status), from the group that has been in the waitlist the longest time to the most recent added group. You are asked to format the output so it is readable.

4. doesGroupExist: given a group name, check whether this group already exists in the list.

5. seatInGroup: given a number N, find the first group in the list whose group size is smaller than or equal to N. Retrieve the name of the group, print out the information of the group, and remove that group from the list.

6. countGroupsAhead: given a group name, count the number of groups waiting ahead of this group.

7. changeGroupStatus: change the status of a group from call-ahead to walk-in.

Note that:

1) The actions (each of which you can think of as a member function of the class) listed above are mandatory. However, there are other functions that are necessary as well for you to complete all the functionalities, and they may not be all listed above (for example, either a parameterized constructor or setter functions for the Group class).

2) The same principal applies for information the class maintains, which you can think of as data members of the class. You are free to add as many necessary data members as you want, but your class should at least contain the data members listed above.

3) You are recommended to use the names listed above as the class, data member, and function names. However, you are not strictly required to do so. If you think you have a more meaningful name, feel free to use yours but you need to think whether your names are more readable and meaningful.

2. Other requirements

1) You are not allowed to use global variables except for the list size (of value 1000), unless you document a justified reason. You may expect a meetup to explain your decision and convince the instructors if you do not want to get penalties from using global variables.

2) You are allowed to write user-defined functions that are not member functions of any classes.

3) You are strongly suggested to limit the number of parameters of each function (to less than six), especially the number of parameters that are passed by reference (to less than two).

4) You are asked to put meaningful comments to your code.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Handbook Of Database Security Applications And Trends

Authors: Michael Gertz, Sushil Jajodia

1st Edition

1441943056, 978-1441943057

More Books

Students also viewed these Databases questions

Question

explain the various forms of fi nancial statements

Answered: 1 week ago

Question

3. SCC Soft Computer

Answered: 1 week ago

Question

2. KMPG LLP

Answered: 1 week ago

Question

5. Wyeth Pharmaceuticals

Answered: 1 week ago