Retrieved from https://studentshare.org/technology/1519824-java-program-shopkeeper
https://studentshare.org/technology/1519824-java-program-shopkeeper.
Some utility methods like getStockValue() and getNeededItems() are also there to return the over all value of the stock and the list of needed items respectively. 3. ShopKeeper class: This class gives the overall graphical user interface to the client so that the client can access both StockTake and Item classes in order to manipulate Items. This class uses some more user-defined classes to construct the GUI. The classes are: a. ShopKeeperDesktopManager class: This class helps to create multiple document interface environment.b. InsertItemFrame class: This class makes a child window for insert Item information.c. NeededItemFrame class: This class makes a child window for displaying the list of needed items whose quantity is zero.
Coding Source codes of all the classes are given along with their file names.Item.javaimport javax.swing.*;import java.io.*;public class Item{ String iName; int iQty; double iPrice; public Item(String iName) { this.iName=iName.toUpperCase(); iQty=0; iPrice=0; } public Item(String iName,int iQty,double iPrice) { setIName(iName.toUpperCase()); setIQty(iQty); setIPrice(iPrice); } public void setIName(String iName) { this.iName=iName.toUpperCase(); } public String getIName() { return iName; } public void setIQty(int iQty) { if(iQty>=0) this.
iQty=iQty; else JOptionPane.showMessageDialog(null,"Qty cannot be -ve","Check Qty",JOptionPane.ERROR_MESSAGE); } public int getIQty() { return iQty; } public void setIPrice(double iPrice) { if(iPrice>0) this.iPrice=iPrice; else JOptionPane.showMessageDialog(null,"Price cannot be -ve or zero","Check Price",JOptionPane.ERROR_MESSAGE); } public double getIPrice() { return iPrice; } public double getValue() { return iPrice*iQty; } public String toString() { return "[Item: "+iName+";Price: "+iPrice+";Quantity: "+iQty+";Value: "+getValue()+"]"; }}StockTake.
javapublic class StockTake{ Item itemsArray[]; int arrSize; int itemCount; public StockTake(int arrSize) { if(arrSize>0) { itemsArray=new Item[arrSize]; this.arrSize=arrSize; this.itemCount=0; } else { itemsArray=new Item[50]; this.arrSize=50; this.itemCount=0; } } public Item[] getItemsArray() { return itemsArray; } public boolean addItem(Item i) { if(itemCount
...Download file to see next pages Read More