Advertisement
Guest User

Untitled

a guest
Dec 4th, 2016
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 3.38 KB | None | 0 0
  1. /*
  2.  * A Program to simulate an Electronic company
  3.  * @author OliverHowes
  4.  */
  5. package electroniccodemo;
  6.  
  7. public class ElectronicCoDemo {
  8.    
  9. /**
  10. * A method to generate a collection of StockType objects to use as
  11. * test data
  12. * @return an array of StockType objects
  13. *
  14. */
  15.     public static StockType [] generateStock(){
  16.         String [] inventoryIDlist =
  17.         { "AB123", "AB125", "AC143","AC143", "AD124", "AD133", "BE123", "BE128",
  18.         "BE144", "BG223", "BG251", "BG444","CD768", "CD813"};
  19.         int [] stockQuantities =
  20.         {155, 288, 95, 70, 42, 130, 84, 55,72, 18, 45, 50, 64, 28};
  21.         int [] dailyDemands =
  22.         {31, 18, 19, 14, 14, 26, 12, 11, 12,3, 9, 10, 16, 7};
  23.         int [] reorderQuantities =
  24.         {310, 180, 285, 140, 140, 390, 240,110, 120, 60, 135, 100, 160, 140};
  25.         int [] leadTimes =
  26.         {5, 7, 3, 2, 1, 5, 6, 4, 5,2, 3, 2, 4, 3};
  27.        
  28.         int n = inventoryIDlist.length;
  29.        
  30.         StockType [] stockItem = new StockType[n];
  31.        
  32.         for(int i =0; i < n; i++){
  33.             stockItem[i] = new StockType(inventoryIDlist[i],
  34.                     stockQuantities[i], dailyDemands[i],
  35.                     reorderQuantities[i], leadTimes[i]);
  36.         }
  37.         return stockItem;
  38.     }
  39. }
  40.    
  41.    
  42.  
  43.     public static void main(String[] args) {
  44.         StockType stockNew = new StockType();
  45.                
  46.         /* Testing the toString method
  47.         System.out.println(stockNew.toString());
  48.         */
  49.        
  50.         /* Testing the set methods
  51.         stockNew.setId("Stock Name Here");
  52.         stockNew.setQuantity(21);
  53.         stockNew.setDemandRate(7);
  54.         stockNew.setReorderQuantity(25);
  55.         stockNew.setLeadTime(5);
  56.         System.out.println(stockNew.toString());
  57.         */
  58.        
  59.         /* Test get methods
  60.         System.out.println(stockNew.getId());
  61.         System.out.println(stockNew.getQuantity());
  62.         System.out.println(stockNew.getDemandRate());
  63.         System.out.println(stockNew.getReorderQuantity());
  64.         System.out.println(stockNew.getLeadTime());
  65.         System.out.println(stockNew.getOrderStatus());
  66.         */
  67.        
  68.         /* Tests the subtraction of the demand from the overall stock
  69.         stockNew.setQuantity(21);
  70.         stockNew.setDemandRate(7);
  71.         System.out.println(stockNew.toString());
  72.         stockNew.calculateDemand();
  73.         System.out.println(stockNew.toString());
  74.         */
  75.        
  76.         /* Test to determine if batchRecord changes the ststus of orderStatus
  77.         stockNew.batchRecord();
  78.         System.out.println(stockNew.toString());
  79.         */
  80.        
  81.        
  82.         /* Test the addition of the reorderQuantity to the current stock
  83.         stockNew.setQuantity(12);
  84.         stockNew.setReorderQuantity(25);
  85.         stockNew.batchDelivery();
  86.         System.out.println(stockNew.toString());
  87.         */
  88.        
  89.         /* Tests isReOrderPoint with first a greater than arguement, then
  90.             secondly with a less than arguement
  91.        
  92.         stockNew.setQuantity(12);
  93.         stockNew.setLeadTime(5);
  94.         stockNew.setDemandRate(2);
  95.         System.out.println(stockNew.isReOrderPoint());
  96.        
  97.         stockNew.setQuantity(12);
  98.         stockNew.setLeadTime(5);
  99.         stockNew.setDemandRate(3);
  100.         System.out.println(stockNew.isReOrderPoint());
  101.         */
  102.     }
  103.    
  104. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement