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.
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