Question: Java coding The StoreManager needs some new functionality. Now, it will not only be managing the Inventory, but it will also be managing user ShoppingCarts.
Java coding
The StoreManager needs some new functionality. Now, it will not only be managing the Inventory, but it will also be managing user ShoppingCarts. Each user that connects to the store (new StoreView instance) should have their own unique ShoppingCart. If a user adds something to their cart, the Products stock in the store Inventory should be decreased accordingly. A user can also remove items from their cart. Note that if the user removes a product from the shopping cart, the inventory must also be updated accordingly. Upon request, the StoreManager should return a new, unique cartID. This means StoreManager should be keeping track of cartIDs in some way. It could be as simple as having a counter that increments every time a new ShoppingCart is made. This implementation is ultimately up to you. Just be sure to document what you do! A user needs to be able to checkout once they are ready (your method for processing a transaction from Milestone 1 will likely need to be changed, or completely removed). This method should return the total and summary of the items in the cart (print it for the user to see). You can choose to disconnect the user at this point or reset the cart up to you! If the user quits before checking out, any items in the cart should be returned to the Inventory stock. Note: quitting means the user entered quit, not your program suddenly closes; you do not need to worry about that. Now that you will be implementing the UI for the store, you need some way to get the information needed to drive this UI. StoreManager should have some methods that return needed information about ShoppingCarts, or available Products. The StoreView class will be using this information to populate the UI for the user. Remember, all communication by the StoreView class must be done with the StoreManager only!
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
