Question: On some shopping sites ( e . g . , amazon.com ) , a product can have multiple sellers. Usually, the seller list is displayed

On some shopping sites (e.g.,
amazon.com), a product can have multiple sellers. Usually, the seller list is displayed based on
the total cost (product price plus shipping cost). Natually, a seller is listed if it has inventory for the product.
For this assignment, assume you are managing three products: appleIPhone, earBuds, and keyboard. To separately
manage the seller list in ascending order of total cost for each product, use a singly linked list. Ties are broken by seller
names in alphabetically order. When the inventory is zero, the corresponding node is deleted. You can borrow/modify
SinglyLinkedList from the textbook or implement your own. We will evaluate your submissions on
code01.fit.edu so we
strongly recommend you to test your programs on
code01.fit.edu. To preserve invisible characters, we strongly recommend
you to download, NOT copy and paste, input data files.
Input: To simulate the shopping and inventory events, an input file contains events in the same directory as your program
file called HW1.java that has the main method. Initially, each product has no sellers (no inventory). Your submission takes
the input file name as a command-line argument. Each line is one of the following event:
AddSeller product seller price shippingCost quantity
RemoveSeller product seller
IncreaseInventory product seller quantity
CustomerPurchase product seller quantity
DisplaySellerList product
DisplaySellerList considers the cost of one item of the product.
Output: The program prints events to the standard output (screen). Each event is on one line and possible events are:
AddSeller product seller price shippingCost quantity [NonPositiveQuantityError]
RemoveSeller product seller [NonExistingSeller Error]
IncreaseInventory product seller quantity updatedInventory
CustomerPurchase product seller quantity updatedInventory or NotEnoughInventoryError
DepletedInventoryRemoveSeller product seller
DisplaySellerList product
Assume a seller's name is at most 10 characters, use right justification for each column in the seller list. When inventory is
depleted, DepletedInventoryRemoveSeller is displayed and the corresponding node is removed.
 On some shopping sites (e.g., amazon.com), a product can have multiple

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!