Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * A Program to simulate an Electronic company
- * @author OliverHowes
- */
- package electroniccodemo;
- public class ElectronicCoDemo {
- /**
- * A method to generate a collection of StockType objects to use as
- * test data
- * @return an array of StockType objects
- *
- */
- public static StockType [] generateStock(){
- String [] inventoryIDlist =
- { "AB123", "AB125", "AC143","AC143", "AD124", "AD133", "BE123", "BE128",
- "BE144", "BG223", "BG251", "BG444","CD768", "CD813"};
- int [] stockQuantities =
- {155, 288, 95, 70, 42, 130, 84, 55,72, 18, 45, 50, 64, 28};
- int [] dailyDemands =
- {31, 18, 19, 14, 14, 26, 12, 11, 12,3, 9, 10, 16, 7};
- int [] reorderQuantities =
- {310, 180, 285, 140, 140, 390, 240,110, 120, 60, 135, 100, 160, 140};
- int [] leadTimes =
- {5, 7, 3, 2, 1, 5, 6, 4, 5,2, 3, 2, 4, 3};
- int n = inventoryIDlist.length;
- StockType [] stockItem = new StockType[n];
- for(int i =0; i < n; i++){
- stockItem[i] = new StockType(inventoryIDlist[i],
- stockQuantities[i], dailyDemands[i],
- reorderQuantities[i], leadTimes[i]);
- }
- return stockItem;
- }
- }
- public static void main(String[] args) {
- StockType stockNew = new StockType();
- /* Testing the toString method
- System.out.println(stockNew.toString());
- */
- /* Testing the set methods
- stockNew.setId("Stock Name Here");
- stockNew.setQuantity(21);
- stockNew.setDemandRate(7);
- stockNew.setReorderQuantity(25);
- stockNew.setLeadTime(5);
- System.out.println(stockNew.toString());
- */
- /* Test get methods
- System.out.println(stockNew.getId());
- System.out.println(stockNew.getQuantity());
- System.out.println(stockNew.getDemandRate());
- System.out.println(stockNew.getReorderQuantity());
- System.out.println(stockNew.getLeadTime());
- System.out.println(stockNew.getOrderStatus());
- */
- /* Tests the subtraction of the demand from the overall stock
- stockNew.setQuantity(21);
- stockNew.setDemandRate(7);
- System.out.println(stockNew.toString());
- stockNew.calculateDemand();
- System.out.println(stockNew.toString());
- */
- /* Test to determine if batchRecord changes the ststus of orderStatus
- stockNew.batchRecord();
- System.out.println(stockNew.toString());
- */
- /* Test the addition of the reorderQuantity to the current stock
- stockNew.setQuantity(12);
- stockNew.setReorderQuantity(25);
- stockNew.batchDelivery();
- System.out.println(stockNew.toString());
- */
- /* Tests isReOrderPoint with first a greater than arguement, then
- secondly with a less than arguement
- stockNew.setQuantity(12);
- stockNew.setLeadTime(5);
- stockNew.setDemandRate(2);
- System.out.println(stockNew.isReOrderPoint());
- stockNew.setQuantity(12);
- stockNew.setLeadTime(5);
- stockNew.setDemandRate(3);
- System.out.println(stockNew.isReOrderPoint());
- */
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement