package ca1;
public abstract class Store
{
private static int partCode;
private static String description;
private static String binNum;
private static int qtyInStock;
private static int reOrderPoint;
private static int maxNum;
public Store(int partCode, String description, String binNum, int qtyInStock, int reOrderPoint, int maxNum)
{
Store.setPartCode(partCode);
Store.setDescription(description);
Store.setBinNum(binNum);
Store.setQtyInStock(qtyInStock);
Store.setReOrderPoint(reOrderPoint);
Store.setMaxNum(maxNum);
}
public static void setPartCode(int partCode)
{
Store.partCode = partCode;
}
public static int getPartCode()
{
return partCode;
}
public static void setDescription(String description)
{
Store.description = description;
}
public static String getDescription()
{
return description;
}
public static void setBinNum(String binNum)
{
Store.binNum = binNum;
}
public static String getBinNum()
{
return binNum;
}
public static void setReOrderPoint(int reOrderPoint)
{
Store.reOrderPoint = reOrderPoint;
}
public static int getReOrderPoint()
{
return reOrderPoint;
}
public static void setQtyInStock(int qtyInStock)
{
Store.qtyInStock = qtyInStock;
}
public static int getQtyInStock()
{
return qtyInStock;
}
public static void setMaxNum(int maxNum)
{
Store.maxNum = maxNum;
}
public static int getMaxNum()
{
return maxNum;
}
}
public abstract class Food extends Store
{
private static String expiryDate;
public Food(int partCode, String description, String binNum, int qtyInStock, int reOrderPoint, int maxNum, String expiryDate)
{
super(partCode, description, binNum, qtyInStock, reOrderPoint, maxNum);
Food.expiryDate = expiryDate;
}
public static void setExpiryDate(String expiryDate)
{
Food.expiryDate = expiryDate;
}
public static String getExpiryDate()
{
return expiryDate;
}
}
public class CheddarCheese extends Food
{
public CheddarCheese(int partCode, String description, String binNum, int qtyInStock, int reOrderPoint, int maxNum, String expiryDate)
{
super(partCode, description, binNum, qtyInStock, reOrderPoint, maxNum, expiryDate);
}
}
public class DanishBlueCheese extends Food
{
public DanishBlueCheese(int partCode, String description, String binNum, int qtyInStock, int reOrderPoint, int maxNum, String expiryDate)
{
super(partCode, description, binNum, qtyInStock, reOrderPoint, maxNum, expiryDate);
}
}
public class StockList
{
public static void printDetails()
{
System.out.println("Stock List");
System.out.println("Part Code" + " Description" + " Quantity In Stock");
System.out.println(CheddarCheese.getPartCode() + " " + CheddarCheese.getDescription() + " " + CheddarCheese.getQtyInStock());
System.out.println(DanishBlueCheese.getPartCode() + " " + DanishBlueCheese.getDescription() + " " + DanishBlueCheese.getQtyInStock());
}
}
public class TestStore
{
public static void main(String[] args)
{
Food CheddarCheese = new CheddarCheese(324, "Cheddar Cheese", "5c", 15, 10, 20, "01/11/2009");
Food DanishBlueCheese = new DanishBlueCheese(396, "Danish Blue Cheese", "6c", 8, 8, 10, "03/11/2009");
StockList.printDetails();
}
}