Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I am doing this problem in java and I am very confused you are to write a program to assign seats on each flight of

I am doing this problem in java and I am very confused you are to write a program to assign seats on each flight of the airlines only plane (capacity 10 seats) Your program should display the following alternatives Please type 1 for First Class and please type 2 for Economy. If the user types 1, your program should assign a seat in the first-class section (seats 1 5). If the user types 2, your program should assign a seat in the economy section (6 10). Your program should print a boarding pass indicating the persons seat number and whether it is in the first class or economy section of the plane. Use a one-dimensional array of primitive type boolean to represent the seating structure of the plane. Initialize all the elements of the array false indicating that all seats are empty. As each seat is assigned, set the corresponding element of the array to True to indicate that the seat is no longer available. Your program should, of course never assign a seat that has already been assigned. When the economy class section is full, your program should ask the person if Its acceptable to be placed in the first-class section (and vice versa). If yes, then make the appropriate seat assignment. If no, then print the message The plane is full!! Next Flight leaves in 3 Hours Time

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

Database Reliability Engineering Designing And Operating Resilient Database Systems

Authors: Laine Campbell, Charity Majors

1st Edition

978-1491925942

More Books

Students also viewed these Databases questions

Question

Which of the following is NOT built up on AI technique

Answered: 1 week ago