Question: Hello everyone can any create a inventory management class for java for a vending machine that will do the following. 1. Upon selecting an item

Hello everyone can any create a inventory management class for java for a vending machine that will do the following.

1. Upon selecting an item the inventory, the stock for the item reduces by 1.

2. Upon canceling a selection, the stock for the item should increase by 1.

3. Add a button that triggers the display of the entire inventory the inventory should be displayed in a separate grid pane.

?4. Add a button that shows total earnings.

This is the dispenser queue class below let me know if anything else is needed. Thank you.

import java.util.ArrayList;
import javafx.scene.image.ImageView;
public class DispenserQueue {
String brand;
String productName;
String productClass;
ArrayList slot;
ImageView productImage;
//Empty Queue Constructor
public DispenserQueue() {
slot = new ArrayList();
productName = "empty";
brand = "none";
}
//Initialized Queue
public DispenserQueue(Product productType) {
slot = new ArrayList();
this.addProductToQueue(productType);
productName = productType.getName();
brand = productType.getBrand();
productClass = slot.get(0).getProductClass();
String imageName = productName + ".jpg";
productImage = new ImageView(getClass().getResource(imageName).toExternalForm());
//System.out.println( imageName + " Succeeded");
}
//Adds a single product to the queue
public void addProductToQueue(Product productToAdd) {
slot.add(productToAdd);
productName = productToAdd.getName();
}
//Removes the specified product from the queue, ex: expiration date is passed, remove it.
public void removeProductFromQueue(Product productToRemove) {
slot.remove(productToRemove);
}
public String getProductType() {
return brand;
}
public String getBrand() {
return brand;
}
public void setBrand(String brand) {
this.brand = brand;
}
public String getProductName() {
return productName;
}
public void setProductName(String productName) {
this.productName = productName;
}
public ArrayList getSlot() {
return slot;
}
public void setSlot(ArrayList slot) {
this.slot = slot;
}
public boolean isDrinkItem() {
if(productClass.equals("Drink")) {
return true;
}
else {
return false;
}
}
public boolean isChipsItem() {
if(productClass.equals("Chips")) {
return true;
}
else {
return false;
}
}
public boolean isCandyItem() {
if(productClass.equals("Candy")) {
return true;
}
else {
return false;
}
}
public boolean isGumItem() {
if(productClass.equals("Gum")) {
return true;
}
else {
return false;
}
}
public ImageView getProductImage() {
return productImage;
}
}

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!