Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

GRAMMING % 2 0 LESSON - ex 1 1 - Tuesday % 2 0 Section.pdf setSurname ( surname:String ) void getPhoneNumber ( ) :String setPhoneNumber

GRAMMING%20LESSON-ex11-Tuesday%20Section.pdf
setSurname(surname:String) void
getPhoneNumber():String
setPhoneNumber(phonenumber String) void
getMail0 String
setMail(mail String)rvoid
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.
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
image text in transcribed

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

Step: 3

blur-text-image

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

Modern Database Management

Authors: Jeffrey A. Hoffer Fred R. McFadden

9th Edition

B01JXPZ7AK, 9780805360479

More Books

Students also viewed these Databases questions

Question

(a) sin /4 cos /3 = ______. (b) tan /4 sin /6 = ______.

Answered: 1 week ago

Question

e. What do you know about your ethnic background?

Answered: 1 week ago

Question

b. Why were these values considered important?

Answered: 1 week ago