Please solve these two questions. Make a diagram, please.
1. Use a software tool to create a class diagram according to the information presented in the following sequence diagram.
- Customer
- MainWindow
- AddBookView
- BookInfo
- select_Book()
- get_StockNumber(): Integer
- Selected book is identified by selectedBook and its number of copies in stock: Integer
- Data Store
- The added books are kept in 'book_list'
- book_lists
- book_list
- Update List
- addButton_Click()
- View Books
- book_list
- Assert
- [selectedBook!= null]
- Updated 'book_list' with the added number of book_id
- Exit
The GUI has a slot for the Customer to specify 'b' with a positive integer value, and MainWindow has an attribute 's' that is accessible from "AddBookView".
- addBookView: GUI
- setButton_Click(b: Integer): Boolean
- Select Book
- Assert
- book_id
- [b > s] error_Message(): String
- with different error messages
- Add Book
- Selected book is identified by a valid ISBN as book_id
- Error Message
- message: String
- [invalid book_id]
- button_Click(): Boolean
- [valid book_id]
- Cancel
- Set Quantity
- Error Message
- number of book_id
- [n <= 0 | 1 n > stock]
- n' must be a positive
- stock', which is the number in stock
- X
- [0 < n <= stock]
2. The above sequence diagram was created for the "Add Book" use case, whose casual description is given below. In addition, the above activity diagram illustrates the flow of events for the "Add Book" use case after the "View Books" use case. However, this sequence diagram is incomplete. Use a software tool to create a sequence diagram that fully fulfills the "Add Book" use case.
Add Book: The customer can add a selected book to the shopping cart in a specified quantity. If the quantity is within the number available in stock, the system updates the shopping cart with the added book in the book list. Otherwise, a message is presented to indicate the error of either adding a book without selection or inputting an over-stock quantity. The action will be terminated if the customer adds a book without selection or decides to cancel the action of book addition.