Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Need help with this assignment to create an app in the console for an airplane to let customers choose their preferred seating. Any help appreciated,

Need help with this assignment to create an app in the console for an airplane to let customers choose their preferred seating.

Any help appreciated, thanks

Assignment:

A small airline has just purchased a computer for its new automated reservations system. Youve been asked to develop the new system. You are to write an application to assign seats on each flight of the airlines only plane (capacity 16 seats i.e. 4x4 2D array)

Your application will ask users for both their class and seat type preferences. A typical interface will ask Please enter passenger name, Please type 1 for First Class or 2 for Economy then Please type 1 for window and 2 for Isle. Your application should then display a boarding pass indicating the persons name, seat number (e.g. Row 1 Seat 1), and class. Other than the seat being taken, there is no need to retain ticket information once the ticket has been produced unless attempting the research component.

In the programs code, classes are determined by rows, seats by columns. Use a two-dimensional array of primitive type Boolean to represent the seating chart of the plane that is traversed using nested for loops. You must use a single 2D Boolean array for the entire airplane, not one for each class. Initialize all the elements of the array to false to indicate that all the 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 application should never assign a seat that has already been assigned. It is assumed that passengers are class centric and would choose any remaining seat in their preferred class before electing to move classes. In other words, class has precedence over aisle/window seating preferences. When a class section is full, your application should ask the person if its acceptable to be placed in the other class (and vice versa). If yes, ask for their seat type choice and make the appropriate seat assignment. In any case where there are still seats available on the aircraft but not one that is acceptable to the passenger, display the message Next flight leaves in 3 hours and return to processing the next passenger in line. If the whole plane is full, display the same message and provide a means to exit the program.

In addition, your application must:

  • Be able to serve several passengers before it closes. It would be wise to provide a means of closing (i.e. type -1 to exit) the application before the aircraft is full. You program does not need to process multiple airplanes before shutting down.
  • Display a visual representation of the seating on the aircraft when the application starts and each time a seat is booked.
  • On the tickets that the passenger sees, seats will be referred to by their array row and col numbers +1. (E.g. Row 0, Col 0 becomes Row 1, Seat 1 on the ticket)
  • Validation for the name field will include: not empty, letters only

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

Students also viewed these Databases questions