Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Problem: In java Create the classes and interfaces on the UML class diagram. 1) Set numberofseats to 40 and use Seat(id:int) constructor to create 40

image text in transcribed

Problem: In java Create the classes and interfaces on the UML class diagram. 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.

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

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

DB2 Universal Database V7.1 Application Development Certification Guide

Authors: Steve Sanyal, David Martineau, Kevin Gashyna, Michael Kyprianou

1st Edition

0130913677, 978-0130913678

More Books

Students also viewed these Databases questions