Question: PROBLEM #1 (40 points) In the system, there exists a class BookSystem which keeps track of the prices of books in the Book Market. This

 PROBLEM \#1 (40 points) In the system, there exists a class

PROBLEM \#1 (40 points) In the system, there exists a class BookSystem which keeps track of the prices of books in the Book Market. This class supports the following operations: SetPrice(ISBN,price), GetPrice(ISBN), BuyBook(ISBN), SellBook(ISBN), and NumBooks(ISBN). The SetPrice(ISBN,price) operation set a new price for the book uniquely identified by ISBN. The GetPrice (ISBN) operation returns the current price of the book identified by ISBN. The BuyBook(ISBN) operation is used to buy a book identified by ISBN. The SellBook(ISBN) operation is used to sell a book identified by ISBN. The operation NumBooks (ISBN) returns the number of copies of a book identified by ISBN that are available in the system. Notice that each book is uniquely identified by ISBN. In addition, there exist user components in the system (e.g., UserA, UserB, etc.) that are interested in watching the changes in book prices, especially, they are interested in watching the out-of-range book price changes. Specifically, interested users may register with the system to be notified when the price of the book of interest falls outside of the specified price range. During registration, the user needs to provide the boundaries (lowprice, highprice) for the price range for the specific book, where, lowprice is the lower book price and highprice is the upper book price of the price range. At any time users may un-register when they are not interested any longer in watching the out-of-range book price changes of a specific book. Each time when the price of a book changes, the system notifies all registered users (for which the new book price is outside of the specified price range) about the out-of-range book price change. Notice that if the book price change is within the specified price range for a given user, this user is not notified about this price change. Design the system using the Observer pattern. Provide a class diagram for the system that should include classes BookSystem, UserA, and UserB (if necessary introduce new classes and operations). In your design, it should be easy to introduce new types of user components (e.g., User C) that are interested in observing the changing prices of books. Notice that the components in your design should be de-coupled as much as possible. In addition, components should have high cohesion. In your solution: a. Provide a class diagram for the system. For each class list all operations with parameters and specify them using pseudo-code. In addition, for each class provide its attributes/data structures. Make the necessary assumptions for your design. b. Provide two sequence diagrams showing: - How a user component registers to be notified about the out-of-range book price change. - How the system notifies the registered user component about the out-of-range book price change

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!