question archive 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:
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:
Hints: An array can be made up of any data type.A user defined class is a data type.Program requirements and/or constraints:
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