Question
Requirements: To run a successful store you must: Store information about your Customers. Store information about your available Books. Maintain a mapping of which Books
Requirements:
To run a successful store you must:
- Store information about your Customers.
- Store information about your available Books.
- Maintain a mapping of which Books each Customer currently is renting.
-----------------
All of your classes should be properly encapsulated, follow all proper coding conventions discussed to date, and be logically constructed following good Object Oriented design. Your submitted code should compile and run without errors.
-----------------
Step 1: Your Customer class.
- Create a Customer class that stores a Customer ID, First Name, Last Name, and Account Balance.
- Override toString(), equals(), and hashCode() as discussed in class. Customer ID is sufficient to uniquely identify a Customer.
- Create all constructors, getters, setters as necessary
-----------------
Step 2: Your Book class
- Create a Book class that stores a Book Title and Copies Remaining.
- Override toString(), equals(), and hashCode() as discussed in class. Book Title is sufficient to uniquely identify a Book.
- Create all constructors, getters, setters as necessary
-----------------
Step 3: Your Book Store class
- This class is central to your application
- Create a BookStore class that contains your store name, as well as:
- A Set to store books
- A Set to store customers
- A Map specifying which customers have rented which books
- Create the following methods in your BookStore class:
- addBook() : Adds a book to your available titles. It should take the book title and number of available copies as parameters.
- updateBook() : Updates a book in your system. It should take the book title and number of available copies as parameters.
- addCustomer() : Adds a customer to your system. It should take the customer's Customer ID, First Name, Last Name, and Account Balance as parameters.
- updateCustomer() : Updates a customer in your system. It should take the customer's Customer ID, First Name, Last Name, and Account Balance as parameters.
- addRental(): Records the fact that a customer has rented a book. It should take the Customer ID and the book title they would like to rent as parameters. It should verify that the book is available (in the system, and having number of copies > 0), and that the customer is in the system. If these verifications pass, it should record the fact that the book has been rented in the Map, decrement the number of copies of that book are available, and return true. If these verifications fail, it should provide a useful message and return false.
- showAll(): Displays all Books, Customers, and Rentals in a nicely formatted manner using Iterators as described in class.
-----------------
Step 4: Your main() method
In your main method:
- Create an instance of your BookStore class.
- Use the addBook() method to add 3 books to the system
- Use the addCustomer() method to add 2 customers to the system
- Use the addRental() method to make a single customer rent at least two different books
- Use the showAll() method to show all information about the Book Store and its Customers, Books, and Rentals.
-----------------
Step 5: Create a UML Class diagram for all of your classes. Use the three-box structure shown in class and indicate the data type of each attribute.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started