Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create a class called Reservation according to the UML diagram to make a reservation on a flight. The seat preference will consist of a row

Create a class called Reservation according to the UML diagram to make a reservation on a flight. The seat preference will consist of a row number and seat letter (assume 21 rows and seats A, B, C and D).

Reservation

- seats: int [21][4]

- PassengerName: String

- ID : int

- flightNumber : String

- row: int

- seat: int (translate A to 0, B to 1, C to 2, D to 3)

+ Reservation (name : String , id : int, flight : String, requestedRow: int, requestedSeat: char)

+setRow(int : requestedRow) : void

+ setSeat(char : requestedSeat) : void

+ checkSeatAvailability (): boolean

+ makeReservation() : void

+ toString() : String

Attributes:

seatsa 2-dimensional array of "length" rows and "width" columns , assume that this is [21][4],

passengerName the name of the passenger

id : the id number of the passenger , assume that it cannot be zero

flightNumberthe name or flight number of the plane

rowthe passengers preference seat between 21 rows

seat - the passengers preference seat between 4 columns (A to D)

Methods:

Reservation - the constructor. It will allocate memory for the flight number, passengers name and id, and seating preferences of the passenger.

setRow it assigns its parameter value to the class field row

setSeat - it assigns its parameter value to the class field seat

checkSeatAvailability this method accepts the passengers seating preferences and returns false if the seat is already taken, otherwise returns true.

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_2

Step: 3

blur-text-image_3

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

Pro Database Migration To Azure Data Modernization For The Enterprise

Authors: Kevin Kline, Denis McDowell, Dustin Dorsey, Matt Gordon

1st Edition

1484282299, 978-1484282298

More Books

Students also viewed these Databases questions

Question

What are the Five Phases of SDLC? Explain each briefly.

Answered: 1 week ago

Question

How can Change Control Procedures manage Project Creep?

Answered: 1 week ago