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 Observer. The Observable classes (Subjects) will be the ParkingLots. It would be helpful if the notify method in the subjects (and update method in the observers) took a parameter, perhaps an object of type ParkingEvent, which could have fields including the lot, 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 the TransactionManager’s park() method. Based on these requirements you should implement three actor classes in this interaction using java: TransactionManager, ParkingObserver and ParkingLot. 1. The TransactionManager knows nothing of the other two classes but it has a park() method that could take a ParkingEvent. 2. The ParkingObserver 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. Each ParkingLot 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.

Database Systems: Design, Implementation, & Management
12th Edition
ISBN:9781305627482
Author:Carlos Coronel, Steven Morris
Publisher:Carlos Coronel, Steven Morris
Chapter7: Introduction To Structured Query Language (sql)
Section: Chapter Questions
Problem 97C: The following tables provide a very small portion of the data that will be kept in the database....
icon
Related questions
Question

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 Observer. The Observable classes (Subjects) will be the ParkingLots. It would be helpful if the notify method in the subjects (and update method in the observers) took a parameter, perhaps an object of type ParkingEvent, which could have fields including the lot, timeIn, timeOut (if relevant), and permitThe 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 the TransactionManager’s park() method.

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

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

2. The ParkingObserver 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. Each ParkingLot 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
o transactions : List<ParkingTransaction>
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
Transcribed Image Text:C) TransactionManager o transactions : List<ParkingTransaction> 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
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781305627482
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781285196145
Author:
Steven, Steven Morris, Carlos Coronel, Carlos, Coronel, Carlos; Morris, Carlos Coronel and Steven Morris, Carlos Coronel; Steven Morris, Steven Morris; Carlos Coronel
Publisher:
Cengage Learning
A Guide to SQL
A Guide to SQL
Computer Science
ISBN:
9781111527273
Author:
Philip J. Pratt
Publisher:
Course Technology Ptr
Oracle 12c: SQL
Oracle 12c: SQL
Computer Science
ISBN:
9781305251038
Author:
Joan Casteel
Publisher:
Cengage Learning
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage