Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please do this in c + + Goal The purpose of the second programming assignment is to experience stacks, queues, and new data structures. The
Please do this in c
Goal
The purpose of the second programming assignment is to experience stacks, queues, and new data structures. The data structures for this assignment are an array and a circular linked list.
Problem Statement
Have you been to a popular restaurant recently? Many are using cell phones to notify groups when their table is ready. But, why not an App? It could let groups know their place in line and be a sales tool for the restaurant to forward coupons and other promotions to increase business.
Lets say you had a friend opening up a new restaurant business and they are looking for help with the software support. They have asked you to be part of the project. You have decided that a queue would be a great ADT for keeping track of who is in line, and how long it will take before they get a table. You have also decided that a stack would be great for reaching out to the customers who most recently frequented the restaurant to provide promotional materials so that they will return before forgetting about this great new restaurant.
Programming
There are two ADTs in this program Queue and Stack ADT
Part I: The Queue ADT
The queue will represent the people in line waiting for a table. The queue is ordered based on the order in which the groups arrive.
The data should include:
Name of the group
Number of people in the group
If there is anyone who needs special seating If so include the information about any requirements eg wheel chair or high chair
If the group would like to receive coupons and other promotional materials. If so include the contact name full name and email address.
The queue should be implemented using a circular linked list of people, where the rear pointer points to the most recent group to arrive at the restaurant, and rearnext points to the first group to arrive that hasnt yet been seated. You must implement enqueue, dequeue, peek, and display. Enqueue would be used when people arrive. Dequeue would be used when groups get seated. Display should include the number in line, so people will know how long of a wait they have. The queue needs to be prepopulated for testing when the program runs which means you need to load a set of group data from the external file at the beginning of the program.
Part II: The Stack ADT
The stack then will represent people interested in receiving promotional material, which should include their full name and email address.
The stack should be implemented using an array, where each element in the array is a person interested in promotional materials. The array must be dynamically allocated. Have the constructor receive the size of the array from the client program. Stack ADT functions should include push, pop, peek, and display. When a group gets seated at a table, it is time to push their information onto the stack if they are interested in promotional materials.
Then, when the manager contacts those people using pop when there are a few new promotional events eg a pumpkin carving party As you know, using a stack will allow the manager to contact the most recent people who have frequented the restaurant. The manager doesnt want to entirely lose this information, so they would like it saved in an external data file after being removed from the stack.
Part III: The Driver or the Test Program
The test program needs to first load the test data set from external file at the beginning of the program. This includes the test data to populate the queue and the test data to populate the stack. The menubased user interface should allow user to usetest ALL the functionalities of the program. Try to make the user interface easier to use.
Always prompt user when you need input data.
The prompt needs to be meaningful. Example works great. EgEnter special seating h for high chair, w for wheel chair, n for none:
When asking user to choose some existing data, index works great. You can display the data with index preceding each one first.
Things you should know...as part of your program
Do not use statically allocated arrays in your classes or structures used by the ADT.
All data members in a class must be private
Never perform input operations from your data structure class in CS
Global variables are not allowed in CS
Do not use the String class! use arrays of characters instead! You may use the cstring library.
Use modular design, separating the h files from the cpp files. Remember, h files should contain the class header and any necessary prototypes. The cpp files should contain function definitions. Never #include" cpp files!
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