Question: Three classes have to do the following : - product : store info about the items, can only have the name price and product id.

Three classes have to do the following :
- product : store info about the items, can only have the name price and product id.
- inventory : get the amount of stock from product is, add stock from id, remove stock from id, get info on a product from the id, initialize the inventory by setting contents if tbe inventory to a default value
- store manager: create new inventort object, have functionality to check how much stock of a product is in inventory, functionality to process a transaction given an array of product info (check the quantity exists in inventory and return the total, if not enough quantity return -1, subtract quantity if succesful transaction)  Three classes have to do the following : - product :
store info about the items, can only have the name price and
product id. - inventory : get the amount of stock from product

StoreManager.java Product.java Inventory.java public class Product { private String name; private int id; private double price; I public void ProductItem(){ id=0; name="Name not available."; price=0.0; 1 2 public void ProductItem(int productId, String productName, int productPrice) { this.id=productId; this.name=productName; this.price=productPrice; 13 14 15 16 19 22 25 26 D epublic void setProductId(int itemid) { id=itemId;} epublic void setProductName(String itemName) { name=itemName; } epublic void setProductPrice(int itemPrice) { price=itemPrice; } public void setPrice (double itemPrice) { (itemPrice > 0.00) { price = itemPrice; } else { price = 0.00; } } public String getName() { return name;) 27 28 e 29 30 31 34 35 38 41 public double getPrice() { return price; } public int getId() { return id;) } Product.java Inventory.java Store Manager.java import java.util.ArrayList; public class Inventorysiten> { int quantity =0; 5 private ArrayList items = new ArrayList(); 7 e 12 15 16 17 18 19 20 21 22 23 24 public void add() { this.quantity++; } I public void remove() { this.quantity--; } public void increaseQuantity(string itemName) { for (Item item : this itens) { if (itemName.equals(item.getName())) { item.add(); return; e } } public void decreaseQuantity(String itemName) { for (Item item : this items) { it (itemName.equals(item.qetime()) { (item.getquantity()>=0) { 1tem.remove(); } return; 26 27 28 20 30 31 32 A) Product.java Inventory.java Store Manager public class store antert public void increaseQuantity (String productName) { for (Item iten: this. itens) { 19 (productName.equals(item.getName())) { item.add(); return; } } Q 20 11 13 public void decreaseQuantity(String itemName) { for (iten item : this itens) { 17 (itemName.equals(item.getlane()) { it (item.getQuantity()>=0) { Iten.remove(); B 15 16 17 18 return; 19 20 23 E

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!