School is holding an award ceremony for outstanding students and inviting their family members.The staff in charge of this event, need to know the number of possible attendees to make proper arrangements.
Students need to sign in, staff need to first verify whether the student is on the awards list, and how many family members will accompany them and know about their possible preferential seatings. You are asked to write a program to facilitate this process.
The following is a list of information you need to know to write this program:
We start by prompting the user for the following information:
1. Please enter the number of students who are eligible to attend.
2. Please enter the file-name containing the names of the eligible students.
3. Please enter the number of VIP tickets:
Following the description of the seating space as well as the above interaction with the user, you have the information to create your data structures:
The following provides more explanations about the requirements of this program:
453 Cynthia Rhodes
125 Marc Jones
. . .
[student's ID][space][Number of guests][space][-1, or a row number][Enter]
An example:
222 3 -1
178 0 2
. . .
The third item on each line is for student's seating preferences:
-1 indicates no preference, student and their party will be seated anywhere space is available. We look for a space sequentially starting from the first row and moving onwards. So the seating chart will be filled starting from the first row to the second, etc.
A row number in the range 0-9 indicates that the student and their party would like to be seated together and in a preferred row.
We do not know how many lines there will be in this file, and we do not need to know since we know how to code scenarios like this, Right?
In processing this file, you first should verify the following:
For the sake of brevity of your program, we can safely assume that there won't be any other anomalies outside the above cases.
The following lists the steps taken on each line in this file. Please note that upon a disqualifying element of this data you should move on to the next applicant.
bool isFound( Student *, int, string );
***** void noPrefSeating(string [][colSize], int, string, int, vector < string> &);
***** void prefSeating(string [][colSize], int, string, int, int, vector < string> &);
Your program will be based on the following menu:
Please choose an option:
1. Register for the event:
Please enter the file name:
2. Display the seating chart.
3. Which row has the most number of VIP tickets?
4. Display the list of IDs of those who could not be registered.
5. Exit.
Option 1. This option will follow another prompt for the user to input the name of the file. Your program then should process the contents of this file and seat the students who met the criteria, and populate the vector based on the IDs of those who did not.
Some important points about how to seat students and their guests:
One way of finding available seats based on user's seating preferences is to use a pointer!
Yes, a pointer! Let me see if I can convince you:
Let's say I have 3 guests and I would like to be seated in row #2. You can set up a loop that only iterates through seatingChart[2] row. When you focus on that specific row, you need to first look for the very first "empty" seat i.e. the one that contains "000". When you find that cell, you stop looping since you have some investigation to do: you have to see whether you have enough seats available in that row, and also whether they are all "000"s. Checking this dual-condition requires us "looking ahead" before making any assignment. This means that we dont want to make any changes to the seating chart unless we are sure we have the availability. This is where a pointer could help. Set up a pointer to where you first find an available spot, let the pointer go and check the lay of the land for you, let it march on the row and check the seats, count them and see whether they are available. And only after you made sure that you have the right number of seats available and adjacent to one another, you can REASSIGN the pointer to where you started and this time use it to modify your seating chart. When the pointer is done with its job, you can end the search loop.
You do not have to use a pointer, but I strongly recommend that you do!
In this option you MUST use the above mentioned functions based on the seating preferences or lack thereof.
Option 2. You MUST use a function whose prototype is given below:
void displaySeatingChart(string [][colSize], int);
Option 3. You MUST use a function whose prototype is given below:
void displayTheVector(vector < string>);
Option 4. Must use the following function. It simply looks for the maximum number of VIP seats in a row, and returns the row number.
int maxVIPRow(string [][colSize], int);
A sample run of this program with the files that I will upload along with this document is given as the last page here. Use it as a reference to make sure you understand the requirements of the assignment. Notice your output will be different as the VIP seats are randomly chosen and will be different every time you compile and run your program.