There is this assignment that is due on Monday and it has been really frustrating to me. As you can see by the quote below, the purpose of the program is to assign people seats at a theater.
A performance theater has 2 sections of seating. Rows 1 to 5 are for premium tickets and rows 6-20 are for regular tickets. Each row has 10 seats - seats are referred as A, B, C, … H, I, and J. Row # and seat position are printed together in the tickets. For example, seats in row 2 are 2A, 2B, 2C, 2D, 2E, 2F, 2G, 2H, 2I, and 2J. Problem statement is to ask the user about the section preference (premium vs regular tickets), get # of attendees as input and assign the best possible seating (start searching for seats from the front row - keep going up until the seats are found. Seat people left to right in each row). If the party cannot be seated together, seat them in multiple rows/segments. Assume that # of tickets in each party does not exceed 10. Your program need not be "too intelligent" when the party has to be seated in multiple rows. Here is the sample input and output to give you an idea about the processing.
Here is the sample input & output. Input is shown in bold.
Premium(1) or Regular (2): 1
# of tickets: 5
Your seats are: 1A 1B 1C 1D 1E
Premium(1) or Regular (2): 2
# of tickets: 4
Your seats are: 6A 6B 6C 6D
Premium(1) or Regular (2): 1
# of tickets: 6
Your seats are: 2A 2B 2C 2D 2E 2F
Premium(1) or Regular (2): 2
# of tickets: 5
Your seats are: 6E 6F 6G 6H 6I
…
Premium(1) or Regular (2): 1
# of tickets: 4
Your seats are: 2J 3I 3J 4J
...
Premium(1) or Regular (2): 1
# of tickets: 10
Sorry, only 4 premium seats are available.
So basically the program not only has to step through each row and fill up each seat, it also has to take the remaining empty seats into account and fill them up as well even if it means assigning to multiple rows at a time. But this is really frustrating because even though I managed to sort of get it to work, I have not figured out a way to assign tickets/people to multiple rows when they are all getting filled up. Here is my code. I'd like for you to run it as well and see for yourself as I do not know if I am on the right track or not. Also I have only been working with the array for the premium seating. I have not done the regular seating yet.