Fill This Form To Receive Instant Help

Help in Homework
trustpilot ratings
google ratings


Homework answers / question archive / This assignment consists of various steps, at a mininum, commit your code at the end of every step with a meaningful commit message including the part number you're addressing

This assignment consists of various steps, at a mininum, commit your code at the end of every step with a meaningful commit message including the part number you're addressing

Computer Science

This assignment consists of various steps, at a mininum, commit your code at the end of every step with a meaningful commit message including the part number you're addressing. Make sure you push your code often.

Class and method names that are specifically defined in this document must be exact (for example Inventory) and be placed under the com.mycompany.store package. Any additional classes or methods that you require have no naming or package restrictions. Pay special attention to quality. Quality is more important than quantity in this exercise. If you are unable to complete all the tasks don't worry.

Your submission must be pushed to GitLab in order to be reviewed. Follow the instructions on the email you received to submit your assignment or if you have any questions.

It's required that you include jUnit tests with your assignment.

A sample flow of how these classes/methods may be used have been provided in the StoreApplication class. This is by no means an exhaustive list but it's serve to clarify the intent of the APIs.

Good luck!


Background

MyCompany is opening up a new online store and needs a  system to serve as the inventory and shopping cart system.


Part 1 - Fill up the Inventory

The Inventory class is meant to represent an in-memory inventory of all the products at the MyCompany store. MyCompany has a process that generates CSV files which represent updates to our inventory. The CSV format is as follows:

upc,name,wholesalePrice,retailPrice,quantity
A123,Apple,0.50,1.00,100
B234,Peach,0.35,0.75,200
C123,Milk,2.15,4.50,40
For this part, implement the Inventory.replenish method. Do not change the signatures of any of the existing methods on the Inventory class. In order to capture the retailPrice, you may need to modify the Product class. The rules for the replenish method are as follows:


If a product does not yet exist, add the Product information to the inventory
If a product exists, update the quantity of the product in the inventory by adding the quantity the value from the CSV. For example, if the inventory contains "upc123" with "3" items and a new entry on the CSV has "upc123" with "9" then the final result on the inventory would be "upc123" - "12 items".


Implement the iterator method on the Inventory that will allow for iterating over the products in the inventory. This method will also be helpful when performing unit testing.

You may write any additional public methods on the Inventory that will help you implement and unit test your solution.


Part 2 - Populate a ShoppingCart

This part focuses on using the values in the inventory to populate a shopping cart. A ShoppingCart can have items added or removed via the addItems and removeItems method. Implement those methods following these rules:


An item can only be added if the upc does exists in the inventory associated to the ShoppingCart.
If the quantity of items to add exceeds the available number of items for that Product in the inventory, the operation should abort and return false leaving the ShoppingCart unchanged.
An item can only be removed from the ShoppingCart if it exists in the shopping cart.
If the quantity of items removed from the ShoppingCart exceeds the number of items in the ShoppingCart, the operation should abort and return false leaving the ShoppingCart unchanged.


You may write any additional public methods on the Inventory and ShoppingCart that will help you implement and unit test your solution.


Part 3 - Checkout

The final part includes implementing a very simple checkout process. In this part you will implement the getTotal() method:


Return the running total of the ShoppingCart contents so far by using the retailPrice

If the ShoppingCart is empty, simply return 0.00

Implement the checkout method which will:


Clear out the shopping cart
Reduce the quantity of each product based on the purchased items. For example, if the inventory started with 100 apples and my shopping cart contains 3 apples, the inventory should be updated to 97 apples.


Exception and error handling is left up to you to decide how you want to handle it. As with the other sections, you may write any additional public methods on the Inventory and ShoppingCart that will help you implement and unit test your solution

pur-new-sol

Purchase A New Answer

Custom new solution created by our subject matter experts

GET A QUOTE

Related Questions