Answered step by step
Verified Expert Solution
Question
1 Approved Answer
JAVA import java.util.Map; /** * COMP1110 Final Exam, Question 3ii */ public class Q3StockManager { /** * A new vendor has been introduced. * *
JAVA
import java.util.Map; /** * COMP1110 Final Exam, Question 3ii */ public class Q3StockManager { /** * A new vendor has been introduced. * * @param vid The vid of the new vendor vendor * @param name The vendors name */ public void newVendor(String vid, String name) { // FIXME Question 3iia: complete this function } /** * A new product has been introduced. * * @param sku The products sku * @param vid The vid of the product's vendor * @param name The products name * @param price The products price (per unit) */ public void newItem(String sku, String vid, String name, double price) { // FIXME Question 3iib: complete this function } /** * Return the name of a product. * * @param sku The products sku * @return the name of the product */ public String getItemName(String sku) { return null; // FIXME Question 3iic: complete this function } /** * Return the name of a product's vendor. * * @param sku The products sku * @return the name of the product's vendor */ public String getItemVendorName(String sku) { return null; // FIXME Question 3iid: complete this function }; /** * Return the price of a product. * * @param sku The products sku * @return the price of the product */ public double getItemPrice(String sku) { return -1; // FIXME Question 3iie: complete this function }; /** * Return the amount of stock for a product. * * @param sku The products sku * @return the number of items in stock */ public int getStock(String sku) { return -1; // FIXME Question 3iif: complete this function }; /** * An product has been sold; reduce current stock accordingly. * * @param sku The products sku * @param sold The quantity sold * @return The number of items of stock remaining after the sale */ public int sale(String sku, int sold) { return -1; // FIXME Question 3iig: complete this function } /** * New stock has arrived; increase current stock accordingly. * * @param sku The products sku * @param added The quantity newly arrived */ public void addStock(String sku, int added) { // FIXME Question 3iih: complete this function } /** * Set the target amount of stock for a product. * * @param sku The items sku * @param target The target quantity desired to be held in stock */ public void setTargetStock(String sku, int target) { // FIXME Question 3iij: complete this function } /** * Stock has been carefully counted. Set current stock correctly. * * @param sku The products sku * @param actual The quantity actually in the store * @return The stock loss or gain (new current old current) */ public int setActualStock(String sku, int actual) { return 0; // FIXME Question 3iik: complete this function } /** * For a given vendor, return a map indicating for each product provided by * that vendor, the number of items required in order to reach the target * stock for that item (target - stock). A positive number indicates that * stock is needed, a negative number indicates that there is extra stock. * * @param vid The VID of the vendor to be queried * @return A map of item SKUs and the difference between target and actual stock for that item */ public MapgetStockRequired(String vid) { return null; // FIXME Question 3iil: complete this function } }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored 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