Advertisement
Guest User

createWorker

a guest
Oct 25th, 2016
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.81 KB | None | 0 0
  1.     public static Object createEmployee(int type){
  2.        
  3.         Object tempObject = new Object();
  4.        
  5.         if(type == 0){
  6.             Employee tempEmployee = new Employee();
  7.            
  8.             tempEmployee.name = "Bronius";
  9.             tempEmployee.hours = 120;
  10.             tempEmployee.payPerHour = 55;
  11.            
  12.             tempObject = tempEmployee;
  13.             employeesCount++;
  14.            
  15.         }else if(type == 1){
  16.             Accountant tempAccountant = new Accountant();
  17.            
  18.             tempAccountant.name = "Staska";
  19.             tempAccountant.hours = 120;
  20.             tempAccountant.payPerHour = 55;
  21.            
  22.             tempObject = tempAccountant;
  23.             accountantsCount++;
  24.            
  25.         }else if(type == 2){
  26.             Manager tempManager = new Manager();
  27.            
  28.             tempManager.name = "Birute";
  29.             tempManager.hours = 120;
  30.             tempManager.payPerHour = 55;
  31.            
  32.             tempObject = tempManager;
  33.             managersCount++;
  34.         }
  35.        
  36.         return tempObject;
  37.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement