classes CriticalException and NonCriticalException. Question 2: Write the source code of classes Person and Employee. Question 3: Write the source code of class Room. The details of its methods are as follows: setCapacity: If one attempts to set a negative capacity or a capacity greater than maxRoomCapacity, a CriticalException is generated. setDailyRate: A room’s daily rate must not be changed while there are guests in it. Otherwise, a NonCriticalException is generated. Constructor must use the setter methods described above. addGuest: A guest must not be added multiple times.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

[JAVA]

Answer these questions according to the UML class schema given above. You may need to extract hidden information from the schema and add necessary code. You don’t have to consider inconsistencies other than the ones explicitly stated in questions. You will be writing some part of hotel management software.

Pay attention to the following details about the program logic when writing your code:

Question 1: Write the source code of classes CriticalException and NonCriticalException.

Question 2: Write the source code of classes Person and Employee.

Question 3: Write the source code of class Room. The details of its methods are as follows:

  • setCapacity: If one attempts to set a negative capacity or a capacity greater than maxRoomCapacity, a CriticalException is generated.
  • setDailyRate: A room’s daily rate must not be changed while there are guests in it. Otherwise, a NonCriticalException is generated.
  • Constructor must use the setter methods described above.
  • addGuest: A guest must not be added multiple times. Otherwise, a CriticalException is generated.
  • emptyRoom: Code it according to the given sequence diagram on the second paper.
  • toString: Returns a String that contains information about the room number, its capacity and its current guests’ names.
Hotel
ReportPastincome
|- rooms : Hashtable<Integer,Room>
|- visits : LinkedList<Visit>
|- pool : ExecutorService
- addRoom( Room)
- addRoom( roomNr: int, capacity : int, rate : double )
- searchGuest( name : String ): Guest
|- newArrivalToRoom( aGuest: Guest, roomNr: int )
- addGuestToRoom( aGuest: Guest, roomNr: int)
- findRoomNrOfGuest( name : String): int
|- emptyRoom( roomNr: int )
|- report()
- backup( fileName : String )
|- restore( fileName : String )
ReportCurrentRevenue
1
checked
CriticalException
NonCriticalException
unchecked
1
«Abstract»
Room
Person
Visit
|- roomNr: int {final}
- maxRoomCapacity : int {final, static}
|- dailyRate : double
|- guests : LinkedList<Guest>
-v: Visit
+ Room(roomNr: int , capacity : int, dailyRate : double )
setCapacity( int )
+ setDailyRate( double )
+ addGuest( Guest)
+ emptyRoom( ): Visit
+ searchGuest( name : String): Guest
+ toString(): String
getGuestNames(): String
+ getVisit( ) : Visit
|- name, address, phoneNr: String
+ Person( name : String, nationallD: int)
-from, to : java.util.Date
guestNames : String
totalPrice : double
+ Visit( from : Date, room: Room)
+ endVisit( )
getTotalPrice(): double
+ getCurrentRevenue( ): double
- getVisitDurationInDays( begin, end : Date ): long
0.1
Employee
Guest
|- emplD : int {final}
|- enlisted : java.util.Date
Transcribed Image Text:Hotel ReportPastincome |- rooms : Hashtable<Integer,Room> |- visits : LinkedList<Visit> |- pool : ExecutorService - addRoom( Room) - addRoom( roomNr: int, capacity : int, rate : double ) - searchGuest( name : String ): Guest |- newArrivalToRoom( aGuest: Guest, roomNr: int ) - addGuestToRoom( aGuest: Guest, roomNr: int) - findRoomNrOfGuest( name : String): int |- emptyRoom( roomNr: int ) |- report() - backup( fileName : String ) |- restore( fileName : String ) ReportCurrentRevenue 1 checked CriticalException NonCriticalException unchecked 1 «Abstract» Room Person Visit |- roomNr: int {final} - maxRoomCapacity : int {final, static} |- dailyRate : double |- guests : LinkedList<Guest> -v: Visit + Room(roomNr: int , capacity : int, dailyRate : double ) setCapacity( int ) + setDailyRate( double ) + addGuest( Guest) + emptyRoom( ): Visit + searchGuest( name : String): Guest + toString(): String getGuestNames(): String + getVisit( ) : Visit |- name, address, phoneNr: String + Person( name : String, nationallD: int) -from, to : java.util.Date guestNames : String totalPrice : double + Visit( from : Date, room: Room) + endVisit( ) getTotalPrice(): double + getCurrentRevenue( ): double - getVisitDurationInDays( begin, end : Date ): long 0.1 Employee Guest |- emplD : int {final} |- enlisted : java.util.Date
Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Class
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
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education