Implement a safe home access Java application based on the diagram above. Consider also following functional requirements in implementing your program:
- If pin is wrong enterPin method shall throw an InvalidPinException.
- If 3 consecutive attempts are made to enter pin then door is locked(until master key pin is used) and enterPin method shall throw TooManyAttemptsException. Any further invocations of enterPin method will throw TooManyAttemptsException.
- If master key pin is used, door will be unlocked and retries count will be reset to 0.
- If pin is correct, door shall be opened or closed depending on current state (if open will be closed, if closed will be opened)
- When tenant already exists by name, addTenant method will throw TenantAlreadyExistsException.
- When tenant not found, removeTenant method will throw TenantNotFoundException.
- All attempts (successful or not) will be logged in access log list.
- Simulate all operations in main from SafeHome.
NOTE - Java project come with prefiled unit tests. You should make sure all tests pass. You are not allowed to change unit tests (except initialisation of Controller object in the instantiateDoorController() method).
For Safe Home Access application create UML state machine diagram.
For Safe Home Access application create UML use case diagram.