Write a program that does reservations for a theatre with 5 rows of seats, and 9 seats per row. The rows are numbered from ‘A’ to ‘E’ (back to front) and the seats from 1 to 9 in each row. The user should be presented with a seat plan (showing the current bookings) from which a number of seats in one row can be booked. For example
 

1 2 3 4 5 6 7 8 9
A - - - - - - - - -
B - - - - - - - - -
C - - - - - - - - -
D - - - - - - - - -
E - - - - - - - - -
In which row do you want seats? A
How many seats? 2
starting at which number? 4

1 2 3 4 5 6 7 8 9
A - - R R - - - - -
B - - - - - - - - -
C - - - - - - - - -
D - - - - - - - - -
E - - - - - - - - -

In which row do you want seats? A
How many seats? 5
Starting at which number? 3
PROBLEM: A3 is already reserved
In which row do you want seats? Q

Store the data in a two-dimensional array of characters. Initially all the elements of the array contain the character -, to indicate that the seats are available. When a reservation , the program must determine if the requested seats are available and if they are, it must reserve them. A reservation is made by assigning the character R to the elements in question. If any of the requested seats is already reserved (or the requested seats fall outside the seat plan), the entire reservation must be rejected with an appropriate message. The user must enter Q (for the row) to quit the program.

Those seem like pretty explicit rules. What have you accomplished so far? What do you need help with?

This article has been dead for over six months. Start a new discussion instead.