Answered step by step
Verified Expert Solution
Question
1 Approved Answer
GRAMMING % 2 0 LESSON - ex 1 1 - Tuesday % 2 0 Section.pdf setSurname ( surname:String ) void getPhoneNumber ( ) :String setPhoneNumber
GRAMMINGLESSONexTuesdaySection.pdf
setSurnamesurname:String void
getPhoneNumber:String
setPhoneNumberphonenumber String void
getMail String
setMailmail Stringrvoid
Set numberofseats to and use Seatid:int constructor to create seats with different ids. Id should be encapsulated but only getter method should be obtained. User will not be able to change the id number, will be just able to see it
At the initilization stage, all seats will have null Passenger and false isReserved values. These values should be obtained in case of creation of new reservation to the seat.
Name, surname, phonenumber, mail values in Passenger class should be encapsulated and getter and setter methods should be obtained.
User will be able to make reservation to any seat but when user tries to make reservation, isReserved value will be searched and if the seat is already reserved then and error message should be shown to the user. Otherwise passenger information will be required from the user and passenger object will be created and assigned to the seat and is Reserved value will be true.
When a reservation of cancel of reservation has happened, numberofreservedseats and numberofunreservedseats values should be updated and printed out to the console to inform the user.
When user wants to cancel any reservation, id should be read from the user and should be found in the arraylist seats and if it is reserved then passenger must be set to null and isReserved value set to false. If it is already not reserved then an error message should be printed to the console.
User should be able to make reservation, cancel reservation and search for reservation. Searching should be done using id value. If the value is found and the seat is already reserved then id and passenger informations should be printed to the console. If it is not reserved then an error message should be printed out to the console informing that the seat is not reserved but id number is this.
Passenger class should use constructor to create passenger object and passenger object should be assigned to a given seat in the reservation stage.
The program should terminate when all the seats are reserved. In this case, all seat and passenger informations should be printed out to the console.
Whenever anv chanoes hannen by means of reservation the hus ohiect should he
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