0% found this document useful (0 votes)
5 views1 page

Event_pseudocode

The document outlines a seating booking system that counts the number of seats already booked and allows users to input the number of seats they wish to book. It validates the input to ensure it is between 1 and 4 and checks if there are enough available seats before confirming the booking. If seats are successfully booked, it outputs the row and seat number for each booking.

Uploaded by

Huzaifa Zaheer
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views1 page

Event_pseudocode

The document outlines a seating booking system that counts the number of seats already booked and allows users to input the number of seats they wish to book. It validates the input to ensure it is between 1 and 4 and checks if there are enough available seats before confirming the booking. If seats are successfully booked, it outputs the row and seat number for each booking.

Uploaded by

Huzaifa Zaheer
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

//Initializing meaningfull identifiers

NumberofSeats=0
Seatbooked=0

//Counting the number of seats already booked and outputting


FOR RowCounter 1 TO 10
FOR SeatCounter 1 TO 20
IF Evening[RowCounter, SeatCounter] = TRUE
THEN
NumberofSeats=NumberofSeats + 1
ENDIF
NEXT SeatCounter
NEXT RowCounter
OUTPUT"Seats already booked are ", NumberofSeats

//Taking input from te user and validating it


OUTPUT"Enter the number of seats you want to book: 1,2,3,4 "
INPUT Seats

WHILE Seats < 1 OR Seats > 4 OR Seats <> ROUND(Seats, 0) DO


OUTPUT"Invalid Seats, enter Seats 1,2,3,4"
INPUT Seats
ENDWHILE

// Checking if the seats are available or not


IF NumberofSeats + Seats > 200
THEN
OUTPUT"House Full "
OUTPUT" Seats available are ", NumberofSeats + Seats - 200
ELSE
// Displaying Seats booked
FOR RowCounter 1 TO 10
FOR SeatCounter 1 TO 20
IF Evening[RowCounter, SeatCounter] =False
THEN
THEN
Evening[RowCounter,SeatCounter]=TRUE
OUTPUT"Your Seat is booked at row ", RowCounter, "seat ",
SeatCounter
Seatbooked= Seatbooked + 1
ENDIF
IF Seatbooked=Seats
THEN
ExitLoop=TRUE
EXIT FOR
ENDIF
IF ExitLoop=TRUE
THEN
EXIT FOR
ENDIF
NEXT SeatCounter
NEXT RowCounter
ENDIF

You might also like