1) Set numberofseats to 40 and use Seat(id:int) constructor to create 40 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. 2) 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. 3) Name, surname, phonenumber, mail values in Passenger class should be encapsulated and getter and setter methods should be obtained. 4) 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 isReserved value will be true. 5) 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. 6) 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. 7) 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. 8) Passenger class should use constructor to create passenger object and passenger object should be assigned to a given seat in the reservation stage. 9) 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. 10) Whenever any changes happen by means of reservation, the bus object should be serialized to a specific folder and again when the program runs again the bus object should be read from that file and should continue from where it left.
1) Set numberofseats to 40 and use Seat(id:int) constructor to create 40 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.
2) 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.
3) Name, surname, phonenumber, mail values in Passenger class should be encapsulated
and getter and setter methods should be obtained.
4) 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
isReserved value will be true.
5) 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.
6) 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.
7) 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.
8) Passenger class should use constructor to create passenger object and passenger object
should be assigned to a given seat in the reservation stage.
9) The
passenger informations should be printed out to the console.
10) Whenever any changes happen by means of reservation, the bus object should be
serialized to a specific folder and again when the program runs again the bus object
should be read from that file and should continue from where it left.
Can you solve this java question
![Problem: Create the classes and interfaces on the UML class diagram.
<<<Interface>>>
Reservation
App1
- bus: Bus
inputreader: Scanner
+ main(args:String[]):void
+ makeReservation (id:int, passenger Passenger): void
deleteReservation(id:int): void
--Use
Bus
-seats: ArrayList<Seat>
-numberofseats int
-numberofreservedseats int
-numberofunreservedseats int
+toString(): String
Seat
-id: int
-passenger: Passenger
-IsReserved: boolean
+ Seat(id:int)
+getld(): int
+toString(): String 1
-name: String
-surname: String
Passenger
-phonenumber: String
-mail: String
+ toString(): String
+ Passenger(name:String, surname:String,
phonenumber:String,mail:String)
+ getName():String
+ setName(name:String):void
+ getSurname(): String
+ setSurname (surname:String):void
+ getPhoneNumber(): String
+ setPhoneNumber(phonenumber:String):void
+ getMail(): String
+ setMail(mail:String):void](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F5271313a-5a1f-4d07-82a4-8e8f0bce0b42%2F0b267c71-092d-4c64-b362-193ac4900c1e%2Fgag2tf4_processed.png&w=3840&q=75)

Step by step
Solved in 5 steps with 3 images









