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

Scenario - 3

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

Scenario - 3

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

A cruise ship has a speciality restaurant where tables can be booked for any of the three sessions: lunch,

early dinner or late dinner. A booking for a table can only be made on the day. There are twenty tables
available to book in the restaurant.

Each session has a session id: Lunch – 1, early dinner -2, late dinner -3

Only one table can be booked at a time.

When a booking is made, the name of the passenger making the booking is recorded, together with
their cabin number and any special dietary requirements.

Write and test a program or programs for a computer system to manage the daily restaurant bookings.
• Your program or programs must include appropriate prompts for the entry of data; data must be
validated on entry.
• Error messages and other output need to be set out clearly and understandably.
• All variables, constants and other identifiers must have meaningful names.
At the start of the day-

Bookings are to be stored in the 2D array Bookings of type Boolean. 1D array Availability stores the
available slots for a booking.

For each table booked: the name of the passenger making the booking, their cabin number and any
special dietary requirements will be stored in variable PName, Cabin, Diet. Use string concatenation (+)
to join PName, Cabin, Diet and store it in the 2D array Passengers (Eg: PName+’,’+Cabin+’,’+Diet).

The data will be recorded as a single string in the passenger array Eg: Passengers[1,1] would contain the
data: Jack, C001, N , if the passenger named Jack from cabin C001 has made a booking with dietary
requirement as none.

The session ID gives the index of each booking data held in the two arrays. For example, details for
Lunch bookings would be held in: Bookings [1,1] to Bookings [1,20] and passenger details corresponding
to the booking will be entered in Passengers [1,1] to Passenger [1,20].
Write a program to do the following:
• Displays a menu showing the two actions available for the Passenger to choose from:
1. Display table availability
2. Making a table booking at the restaurant
• If a table is available, record the passenger’s name, cabin number and any special dietary
requirements. Mark the table as booked for that session. Display the name and cabin number
of the passenger to check, reduce the number of tables available in the Availability array.
• allows an action to be chosen and completed. Menu choice input by the user should be
validated.
• Write a procedure to complete each action, session ID will be passed as a parameter to the
procedures.
• Update the screen display and mark a session as fully booked if all the tables are now booked.

Special dietary requirements - Only one option can be chosen for each booking. The options are
entered as codes with the booking: gluten-free (GF), vegetarian (V), vegan (VG), diabetic (D), none(N).

You might also like