Question
Create a project named as FunAirline, which have 3 classes Flight, Booking and Test classes. 1. Project Name : FunAirline -----2 Mark Flight class has
Create a project named as FunAirline, which have 3 classes Flight, Booking and Test classes.
1. Project Name : FunAirline -----2 Mark
-
Flight class has --- 4 Marks
Attributes/ fields as
-flightNum
- source
- destination
- seats array(30 seats of type boolean (true-taken, false-available) )
-
Booking class have -- 4 Marks
Methods as
selectFlight
selectSeat
(as parametrized method given below)
a) selectFlight : source , destination : compare source destination and display flight numbers and the available seats
b) selectSeat : enter FlightNum and seats -
book the ticket ( set the seat boolean to true for selected flight)
3.) Test Class have main method in main method create array of flights and you can book seat on particular flight and show at the end which seats are available and which are booked. -5Marks
If users books seat 10 for the source: Amritsar and destination Detroit then the output should be
Output should be 1,2,3,4,5,6,7,8,9,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30
If again users books seat 10 for the source: Amritsar and destination Detroit then the output should be
Your output should be
Seat is already booked -2 Marks
If users books seat 10 for the source: Detroit and destination Amritsar then the output should be
Output should be 1,2,3,4,5,6,7,8,9,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30
Correct O/P - 3 Marks
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started