Write a program that helps SJ-trains with seat booking in a railway carriage. On the screen a picture similar to the one below should appear. The seat numbering should be done as it appears on the picture below (Tips: Modulo can be helpful for arranging columns and rows).
When the program is started, the user must specify which carriage to book. (There are
two carriages (Quiet section and Normal section) and the system can only make
bookings in one carriage at a time.). Already booked seat numbers should be displayed
on the screen accordingly, for example by exchanging the seat number with two asterisk With the help of the following menu, the user should be able to book or cancel seats as
well as print tickets of their latest bookings (i.e those that have not already been printed).
What do you wish to do?
• Book, write ‘B’, on the same line followed by the desired number of tickets.
• Cancel, write ‘A’, on the same line followed by a seat number.
• To print the most recently booked tickets, write ‘S’.
• Exit, type ‘Q
Get Free Quote!
410 Experts Online