write a program that can be used to assign and book seats for a commercial cinema.

The cinema has 16 rows, with 20 seats in each row. The seats at the mid-column
(number 5 to 15) of the last 2 rows closest to the doors (row A and B) are Twin seats,
which will be sold in pair, side by side (e.g., buy A5 means paying for both A5 and A6).
The rest of the seats in the row A and B, and all seats in row C to F are Premiere seats.Row G to L are Gold seats, and row M to Z are Economy seats. The map of the cinema is shown in Figure 1. The prices of the seats are shown in Table 1.

Price for different seat category.
Seat Price (RM)
Twin 15
Premiere 12
Gold 10
Economy 6

Write a program that can be used to assign seats for the cinema. The following briefly
describes the Seat Assignment function of such program.

Initially, your program prompts the seating plan to the operator in the following
format:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
A * * * * * * * * * * * * * * * * * * * *
B * * * * * * * * * * * * * * * * * * * *
C * * * * * * * * * * * * * * * * * * * *
D * * * * * * * * * * * * * * * * * * * *
E * * * * * * * * * * * * * * * * * * * *
F * * * * * * * * * * * * * * * * * * * *

G * * * * * * * * * * * * * * * * * * * *
H * * * * * * * * * * * * * * * * * * * *
I * * * * * * * * * * * * * * * * * * * *
J * * * * * * * * * * * * * * * * * * * *
K * * * * * * * * * * * * * * * * * * * *
L * * * * * * * * * * * * * * * * * * * *

M * * * * * * * * * * * * * * * * * * * *
N * * * * * * * * * * * * * * * * * * * *
O * * * * * * * * * * * * * * * * * * * *
P * * * * * * * * * * * * * * * * * * * *
S C R E E N

Number of seats available: 320
Total sales: RM 0

Here, * indicates that the seat is available; x indicates that the seat is unavailable (sold
out); o indicates that the seat is reserved (without payment).
Your program prompts the operator to enter the following information:
i. Number of seat required
ii. Desired seat category (Twin, Premiere, Gold or economy)

Upon entering the information, the program is to list the available seats matched with
the requirements. The list contains the available seats located side by side, in the same row and column that will meet the number of seat required. The list is shown with the starting seat number and the number of seat available after the seat. The operator can then choose to update the status of the seat. For example,

Enter number of seat required: 8
Desired seat category: Premiere
Available seats:
C5, 12
D5, 12
E5, 12
F5, 12

Choose seat: C7
Action: x

Your program then output the seating plan to the operator with updated information,
as shown in the following.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
A * * * * * * * * * * * * * * * * * * * *
B * * * * * * * * * * * * * * * * * * * *
C * * * * * * x x x x x x x x * * * * * *
D * * * * * * * * * * * * * * * * * * * *
E * * * * * * * * * * * * * * * * * * * *
F * * * * * * * * * * * * * * * * * * * *

G * * * * * * * * * * * * * * * * * * * *
H * * * * * * * * * * * * * * * * * * * *
I * * * * * * * * * * * * * * * * * * * *
J * * * * * * * * * * * * * * * * * * * *
K * * * * * * * * * * * * * * * * * * * *
L * * * * * * * * * * * * * * * * * * * *

M * * * * * * * * * * * * * * * * * * * *
N * * * * * * * * * * * * * * * * * * * *
O * * * * * * * * * * * * * * * * * * * *
P * * * * * * * * * * * * * * * * * * * *
S C R E E N

Number of seats available: 312
Total sales: RM 96

Enter number of seat required: 13
Desired seat category: Gold

Available seats: None
Please try again!

If there is no available seat in a row to match the required number of seat, the
operator should break down the number to 2 smaller numbers so that customers are to be
seated in separate rows.

After some time you might have this output in the seating plan:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
A * * x x * * x x * * * * * * x x * * x x
B o x o * x x o o x x o o * * * * x x o *
C x * * o x * * x * * x * x * * o o * * o
D * * * * * * * * * * * * * * * x * o * *
E * * * * * * * * x x * * * * * * * * * *
F * * x * x x o x o * * * * * x * x x * x

G o x o o o * x * * o * * o x o o o * x o
H x * * x * o * * * x x x x * * x * o * *
I * * * o * x x o x o * o * * * * * * * *
J * o x * o x o x * * o * o * * * * * * *
K x x * * x * * * * * * * * x x o o * * x
L o * * * x * * * * x x o x o * x * o x o

M * o * x * o x o x o * x * * o * * x * *
N * * x x x x * x * * o * * * * * * * * x
O o x o * * o x * * * * * x x * x x o x o
P x * * o x x * * * x * * x x * * x x * x
S C R E E N

Number of seats available: 105
Total sales: RM 458

Enter number of seat required: 3
Desired seat category: Economy

Available seats:
N12, 5 N17, 3
O8, 5
P7, 3

Choose seat: N13
Action: o

Your program will output as the following:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
A * * x x * * x x * * * * * * x x * * x x
B o x o * x x o o x x o o * * * * x x o *
C x * * o x * * x * * x * x * * o o * * o
D * * * * * * * * * * * * * * * x * o * *
E * * * * * * * * x x * * * * * * * * * *
F * * x * x x o x o * * * * * x * x x * x

G o x o o o * x * * o * * o x o o o * x o
H x * * x * o * * * x x x x * * x * o * *
I * * * o * x x o x o * o * * * * * * * *
J * o x * o x o x * * o * o * * * * * * *
K x x * * x * * * * * * * * x x o o * * x
L o * * * x * * * * x x o x o * x * o x o

M * o * x * o x o x o * x * * o * * x * *
N * * x x x x * x * * o * o o o * * * * x
O o x o * * o x * * * * * x x * x x o x o
P x * * o x x * * * x * * x x * * x x * x
S C R E E N

Number of seats available: 102
Total sales: RM 458

Notice the changes in the seating plan and the number of seats available. However,
there is no payment received for the reserved seats and hence no change in the total sales value. The reserved seats will be changed into unavailable after payments are received. Your program will block any attempt to change unavailable seats into reserved or available seat status.

The above described only the functions of your program under the Seat Assignment
menu. The complete program should be menu-driven with the following choices:
i. Seat Assignment
ii. Payments (for reserved seat)
iii. Reset Seating Plan
iv. Exit

With the Payment menu available, your program will allow the operator to change the
reserved seats to available seats, considering all reserved seats will expired eventually if payment is not received after some time.

This forum is not a repository for posting homework assignment questions. We don't do your homeworks for you, it is not in your interest or anybody else's.

Try to solve the problem yourself, and if you have problems with specific things, post them back here, show your code that demonstrates your efforts to solve the problem, and it starts from there.

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