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.
OOPs
In today's technology-driven world, computer programming skills are in high demand. The object-oriented programming (OOP) approach is very much useful while designing and maintaining software programs. Object-oriented programming (OOP) is a basic programming paradigm that almost every developer has used at some stage in their career.
Constructor
The easiest way to think of a constructor in object-oriented programming (OOP) languages is:
[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
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.
Step by step
Solved in 2 steps with 1 images