For a parking management system, use the Observer pattern to implement this interaction using Java and implement the three classes mentioned below. Implement a ParkingObserver that has the role of the...


For a parking management system, use the Observer pattern to implement this interaction using Java and implement the three classes mentioned below.


Implement aParkingObserver that has the role of the Observer. The Observable classes (Subjects) will be theParkingLots. It would be helpful if the notify method in the subjects (and update method in the observers) took a parameter, perhaps an object of typeParkingEvent, which could have fields including thelot, timeIn, timeOut (if relevant),and permit.The ParkingObserver should register with each ParkingLot and receive the messages. Once a car enters (in an entry-scan only lot) or leaves (in an entry-scan and exit-scan lot), then the ParkingObserver will be updated, and then can register the charge with the parking system via theTransactionManager’s park() method.



Based on these requirements you should implement three actor classes in this interaction using java:TransactionManager, ParkingObserver and ParkingLot.


1. TheTransactionManager knows nothing of the other two classes but it has a park() method that could take a ParkingEvent.


2. TheParkingObserver class will have a reference to the TransactionManager instance (so that it can call park()) and it will have an update() method that could take a ParkingEvent.


3. EachParkingLot will have a reference to a ParkingObserver, or list of ParkingObservers (they could all have the same instance or there could be one instance for each ParkingLot). When someone enters or exits the parking lot, the ParkingLot instance will call the update() method of ParkingObserver.



 Include small description to your code design.


C) TransactionManager<br>o transactions : List<ParkingTransaction><br>park(Date, ParkingPermit, ParkingLot) : ParkingTransactio<br>© ParkingTransaction<br>date : Date<br>O permit : ParkingPermit<br>O parkingLot : ParkingLot<br>o chargedAmount : Money<br>o getChargedAmount() : Money<br>getPermit() : ParkingPermit<br>C Money<br>O amount : long<br>currency : String<br>C ParkingLot<br>o id : String<br>O name : String<br>O address : Address<br>O getDailyRate(CarType) : Money<br>

Extracted text: C) TransactionManager o transactions : List park(Date, ParkingPermit, ParkingLot) : ParkingTransactio © ParkingTransaction date : Date O permit : ParkingPermit O parkingLot : ParkingLot o chargedAmount : Money o getChargedAmount() : Money getPermit() : ParkingPermit C Money O amount : long currency : String C ParkingLot o id : String O name : String O address : Address O getDailyRate(CarType) : Money
Jun 11, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here