Write pseudocode for a program where the seating map for a particular performanc
ID: 3779244 • Letter: W
Question
Write pseudocode for a program where the seating map for a particular performance at a theater contains 70 rows of 100 seats each. Using an array where applicable, develop the pseudeocode for a program that allows a user to continuously enter each household size and then
a) Allows a user to continuously enter a row number and seat number until they enter an appropriate sentinel value for the row number in order to stop entering input. Each time the user enters a valid row and seat number, the program determines if that seat is available, and if so, marks it as reserved with an “X” (available seats are not marked in any way).
b) Once the user quits, the program outputs
i) each row number followed by the seat numbers in that row that have been reserved
ii) the total number of reserved seats
iii) the total number of available seats This seating map applies only to this particular show. For other shows, the seating map may contain a different number of rows and seats per row, and the program must be capable of being modified for those by editing only two lines of code.
It needs to look like..
start
declerations
num rows = 70
num seats = 100
Explanation / Answer
main function
num rows = 70
num seats = 100
num total_no_of_seats = 7000
declare a 2d array of 70 rows and 100 columns
num count = 0
num booked_seat_count = 0
print "1. To book movie tickets"
print "2. To exit"
please select an option, store it in choice
if choice is equals to 1
enter household size
num hs = household size
enter row no and seat no
num row_no = row no
num seat_no = seat no
call function func_one(row_no,seat_no,hs)
if choice is equals to 2
call function func_two
func_one(row_no,seat_no,hs)
for i in range(0 to hs)
if array[row_no][seat_no + i] not equal to X
update count by 1
if count is equals to hs
for i in range(0 to hs)
array[row_no][seat_no + i] = X
print seats are reserved
break
else:
please re-enter the row number and seat number
func_two()
for row in range (1 to 70)
print row
for seat_no in range (1 to 100)
if array[row][seat_no] is equals to X
update booked seat count by 1
print seat_no
print booked_seat_count
print "available seats", total_no_of_seats - booked_seat_count
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.