question archive Build a simple airline reservation system

Build a simple airline reservation system

Subject:Computer SciencePrice: Bought3

Build a simple airline reservation system. The system will ask the user how many seats they would like to reserve. Next, it will display a seating chart showing the empty seats, and the seats already reserved. An empty seat is indicated by having a seat letter of A-E displayed, an already reserved seat is indicated by an X. The system will continue to ask the user to choose another seat until the number of seats that they requested, have been selected. Finally, the system will display the seats that they selected and ask the user if they will like to perform another transaction.

Notes:

  • The airplane has 15 rows. Rows 1-5 have only four seats (A, B, D, E), and rows 6-15 have 5 seats (A, B, C, D, E).
  • There is an empty row between First Class and Coach (between rows 5 and 6).
  • If the user enters in an invalid seat or a seat that is already reserved, an informative message is displayed
            and they are asked to enter in a new seat.
  • You need think about what type of private member variables, constructors, and methods your object will need.

Unified Modeling Language (UML)

 

                                       Seat 
-rowNum  : int   
-seatLet : char
+isvalidRow()  :bool
+isValidSeat :bool
+setRowNum(int) :void   
+getRowNum() :int
+setSeatLetter(char) :void
+getSeatLetter()  :char
+Seat()                  
+Seat(row, seat)

Implement the Seat.cpp member functions based on the description from the UML diagram

PSEUDOCODE FOR THE CLIENT
  set up constants for first class rows, max seats, max rows
  seats is a 2d array to hold the the seat letter, we will get the row from the column index

  NOTE: just about everything below will be a method call.
  initialize the seats
  display welcome message
  do{
        ask the user for the number of seats that they would like to reserve
        loop (for) until the number of seats has been chosen
        {
            display the free seat message
            display the current seating chart
            do{
                ask the user for the row
                validate the row
            }while the user has not entered a valid row
            
            do{
                ask the user for the seat
                validate the seat
            }while the user has not entered a valid seat
            
            Check to see if the seat is empty
            if the seat is emtpy
                mark the seat as taken
                add the row to the row number taken array
                add the seat to the seat letter taken array
            else (if the seat is NOT empty)    
                decrament the counter in the for loop
                display the error message
        }


  } while the user wants to continue with another transaction

 

The major purposes of this assignment are to demonstrate:

  • good design, particularly pseudocode
         -- Just because your program produces the correct output does not mean that the program is correct.
  • the ability to use UML diagrams as part of the design
  • the appropriate use of classes.
  • good programming practices, including pre- and post-conditions

Hints: An array can be made up of any data type.A user defined class is a data type.Program requirements and/or constraints:

  • Follow the Style Guide. All requirements stated there must be met.
  • You must use a class in an appropriate manner. No class, no points.
  • You must use a 2D aray of Seat to store the data for each seat on the plane.
  • Appropriate use of functions is required. (Remember that all requirements of functions applies.
  • Use appropriate (descriptive) names for the functions. Be sure to use pass-by-value and pass-by-reference parameters
  • Blank lines, spaces, and formatting are important in the output generated by your program. Follow the sample runs.
  • User input is case insensitive.
  • All input must be error checked. If invalid, an informative error message appears and the question is repeated until valid input is entered.
  • Use comments freely throughout the program.
  • No global variables allowed! (-3 points)
  • Formatting must be done for the menu, shape display and grid display like it's done in the sample runs
  •  

Sample Output : User input is in BOLD

Welcome to Early Bird Airlines

How many seats would you like? 3

Empty seats are indicated by a letter.
Full seats are indicated by an 'X'.

  1 A B     D E
  2 A B     D E
  3 A B     D E
  4 A B     D E
  5 A B     D E

  6 A B   C D E
  7 A B   C D E
  8 A B   C D E
  9 A B   C D E
 10 A B   C D E
 11 A B   C D E
 12 A B   C D E
 13 A B   C D E
 14 A B   C D E
 15 A B   C D E
For seat number 1
Please enter the row: 2
Please enter the seat letter: B

Empty seats are indicated by a letter.
Full seats are indicated by an 'X'.

  1 A B     D E
  2 A X     D E
  3 A B     D E
  4 A B     D E
  5 A B     D E

  6 A B   C D E
  7 A B   C D E
  8 A B   C D E
  9 A B   C D E
 10 A B   C D E
 11 A B   C D E
 12 A B   C D E
 13 A B   C D E
 14 A B   C D E
 15 A B   C D E
For seat number 2
Please enter the row: 3
Please enter the seat letter: D

Empty seats are indicated by a letter.
Full seats are indicated by an 'X'.

  1 A B     D E
  2 A X     D E
  3 A B     X E
  4 A B     D E
  5 A B     D E

  6 A B   C D E
  7 A B   C D E
  8 A B   C D E
  9 A B   C D E
 10 A B   C D E
 11 A B   C D E
 12 A B   C D E
 13 A B   C D E
 14 A B   C D E
 15 A B   C D E
For seat number 3
Please enter the row: 6
Please enter the seat letter: E
You have reserved the following seat(s):
2B
3D
6E

Would you like to perform another transaction?[Y/N]y

How many seats would you like? 2

Empty seats are indicated by a letter.
Full seats are indicated by an 'X'.

  1 A B     D E
  2 A X     D E
  3 A B     X E
  4 A B     D E
  5 A B     D E

  6 A B   C D X
  7 A B   C D E
  8 A B   C D E
  9 A B   C D E
 10 A B   C D E
 11 A B   C D E
 12 A B   C D E
 13 A B   C D E
 14 A B   C D E
 15 A B   C D E
For seat number 1
Please enter the row: 2
Please enter the seat letter: B

I am sorry, but that seat is not available
To choose another seat, please tab return to continue.

Empty seats are indicated by a letter.
Full seats are indicated by an 'X'.

  1 A B     D E
  2 A X     D E
  3 A B     X E
  4 A B     D E
  5 A B     D E

  6 A B   C D X
  7 A B   C D E
  8 A B   C D E
  9 A B   C D E
 10 A B   C D E
 11 A B   C D E
 12 A B   C D E
 13 A B   C D E
 14 A B   C D E
 15 A B   C D E
For seat number 1
Please enter the row: 4
Please enter the seat letter: B

Empty seats are indicated by a letter.
Full seats are indicated by an 'X'.

  1 A B     D E
  2 A X     D E
  3 A B     X E
  4 A X     D E
  5 A B     D E

  6 A B   C D X
  7 A B   C D E
  8 A B   C D E
  9 A B   C D E
 10 A B   C D E
 11 A B   C D E
 12 A B   C D E
 13 A B   C D E
 14 A B   C D E
 15 A B   C D E
For seat number 2
Please enter the row: 4
Please enter the seat letter: F
Valid seats are A through E.
Please try again.

Valid seats are A through E.
Please try again.

Please enter the seat letter: C

I am sorry, but that seat is not available
To choose another seat, please tab return to continue.

Empty seats are indicated by a letter.
Full seats are indicated by an 'X'.

  1 A B     D E
  2 A X     D E
  3 A B     X E
  4 A X     D E
  5 A B     D E

  6 A B   C D X
  7 A B   C D E
  8 A B   C D E
  9 A B   C D E
 10 A B   C D E
 11 A B   C D E
 12 A B   C D E
 13 A B   C D E
 14 A B   C D E
 15 A B   C D E
For seat number 2
Please enter the row: 5
Please enter the seat letter: A
You have reserved the following seat(s):
4B
5A

Would you like to perform another transaction?[Y/N]n

pur-new-sol

Purchase A New Answer

Custom new solution created by our subject matter experts

GET A QUOTE