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.

Microsoft Visual C#
7th Edition
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Joyce, Farrell.
Chapter9: Using Classes And Objects
Section: Chapter Questions
Problem 19RQ
icon
Related questions
Question

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.

 

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
Transcribed Image Text: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
Expert Solution
steps

Step by step

Solved in 5 steps with 3 images

Blurred answer
Knowledge Booster
Unreferenced Objects
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,