// Arup Guha
// 4/5/07
// Used to produce sample output for Spring 2007 COP 3330 Homework #5
public class Payroll {

	public static void main(String[] args) {
		
		// Create an array of seven Employees.
		Employee[] workers = new Employee[7];
		
		// Populate the array with examples of all of the different types
		// of Employees.
		workers[0] = new SalariedEmployee("Jen","Williams",10,35000);
		workers[1] = new HourlyEmployee("Joe","Bloggs",15,10,1800,15,50);
		
		workers[2] = new ClericalStaff("Mark","Richards",10,13,1900,0,20);
		workers[3] = new PhoneStaff("Jessica","Roberts",10,7,1800,10,15,30);
		((PhoneStaff)workers[3]).setnumsales(100);
		workers[4] = new Management("Dog","Bert",15,70000);
		((Management)workers[4]).setbonus(true);
		workers[5] = new Researcher("Donald","Knuth",10,50000);
		((Researcher)workers[5]).setgrant(true);
		workers[6] = new ChiefExecutiveOfficer("Bill","Gates",20,200000);
		((ChiefExecutiveOfficer)workers[6]).setbonus(true);
		
		// Loop through four years of each of these employees.
		for (int i=1; i<=4; i++) {
			
			// Print out the year of the simulation.
			System.out.println("Year "+i);
			
			// Do this for each Employee.
			for (int j=0; j<workers.length; j++) {
				workers[j].printw2();
				
				// Randomly sets bonuses and grants.
				if (workers[j] instanceof Researcher)
					((Researcher)workers[j]).setgrant(i%2 == 0);
				if (workers[j] instanceof ChiefExecutiveOfficer)
					((ChiefExecutiveOfficer)workers[j]).setbonus(i%2 == 1);
				else if (workers[j] instanceof Management)
					((Management)workers[j]).setbonus(i%2 == 0);
			}
		}
	}
}