Question
Problem assignment: Complete the program to assign a seat on an airline flight. The user will select First, Business or Economy class. If there is
Problem assignment: Complete the program to assign a seat on an airline flight. The user will select First, Business or Economy class. If there is an available seat, assign it by adding one to the count of the classs seats and displaying a message. If the assignment fills the selected class, display a message that it is now filled. If there are no available seats in the selected class, display a message.
The number of available seats in each class are:
First 10 Business 15 Economy 25
You must use a switch block to branch to each seat class's assignment code. Within each seat class section, use if else statement to determine if a seat is available, and when there is a seat, use a further if statement to determine if the class is full after assigning the seat.
When the user makes a class selection that is not valid (not one of F, B or E, upper or lower case), display an error message. User entries may be upper or lower case letters.
Use the following output messages, exactly. Copy and paste for accuracy. Every output must end with a newline.
You were assigned a seat. First class is now full. There are no seats left in First class. Business class is now full. There are no seats left in Business class. Economy class is now full. There are no seats left in Economy class. You made an invalid choice.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started