raginggeek

CareFactory

Apr 12th, 2017
42
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.55 KB | None | 0 0
  1. public class CareFactory{
  2.     private static ArrayList<Care> CareInventory = new ArrayList<Care>();
  3.    
  4.     public CareFactory(int quantity){
  5.         for(i = 0; i <= quantity; i++){
  6.             CareInventory.Add(new Care);
  7.     }
  8.  
  9.     public getCare(){
  10.         try{
  11.             Care myCare = CareInventory.get(0);
  12.             CareInventory.remove(0);
  13.         } catch (IndexOutOfBoundsException e) {
  14.             System.err.println("ran out of Care! " + e.getMessage());
  15.         }
  16.     }
  17. }
  18.  
  19. public class Care{
  20.     private static Boolean iCare;
  21.     public Care(){
  22.         iCare = true;
  23.     }
  24.  
  25.     public getCareValue(){
  26.         return iCare;
  27.     }
  28. }
Add Comment
Please, Sign In to add comment