Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ PROGRAM Write a program that can be used to assign seats for a commercial airplane. The airplane has 13 rows, with six seats in

C++ PROGRAM

Write a program that can be used to assign seats for a commercial airplane. The airplane has 13 rows, with six seats in each row. Rows 1 and 2 are first class, rows 3 through 7 are business class, and rows 8 through 13 are economy class. Your program must prompt the user to enter the following information:

a. Ticket type (first class, business class, or economy class)

b. Desired seat

Remember to make sure that users are choosing seats from the class they selected. Also, make sure they are not choosing seats that already occupied.

You must show them the entire seating chart, not just the part that is the class they chose to be in. If they pick a seat from a different class, let them know that seat is not in the class they chose and ask if they want to change their class or pick another seat.

Allow the user to purchase multiple tickets.

Re-display the entire chart before each ticket purchase and again after the purchase is completed.

Program Repeats

The program allows the user to keep purchasing tickets until they indicate they are finished

Instructions

Instructions are given to the user telling them which rows are First Class, Business Class, and Economy. After they select their class, display the seating chart, the whole chart, not just the part that is in their class, and ask them to select a seat.

User input

The program should not force the user to input their data in upper or lower case. It should accept both uppercase and lowercase and convert it in the program.

Testing Class

After the user selects their desired class, then ask them for a seat number by row and column. If the seat they select is out of their selected class, then alert the user and ask them if they prefer a ticket in that class. If they say yes, then attempt to assign them a seat in the newly selected class, if not, ask them for another seat number. Remember to always print the seating chart again when asking for a new seat number.

Testing if seat is available

After the user has successfully selected a seat in their desired class, test to make sure that the seat that they selected is really available. If not, let the user know that the seat is alreay taken and ask them for another seat. Remember that the new seat may not be in their class range in which case you will have to let them know they chose a seat in a different class and ask them if they want to change class. If so, then check to see if the new seat is available. If not, then ask them to select another seat.

After a seat is successfully chosen, be sure to update the array and redisplay the entire seating chart.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2010 Barcelona Spain September 2010 Proceedings Part 2 Lnai 6322

Authors: Jose L. Balcazar ,Francesco Bonchi ,Aristides Gionis ,Michele Sebag

2010th Edition

364215882X, 978-3642158827

More Books

Students also viewed these Databases questions