below is aw far av gone......
package person;
import java.util.Arrays;
/**
*
* @author student
*/
public class Main {
/**
* @param args the command line arguments
*/
public static void main(String[] args)
{
Person[] staff = new Person[8];
staff[0] = new Student("Allen", "King", 2004, 5);
staff[1] = new Student("Joseph", "Keane", 2004, 4);
staff[2] = new Employee("joe", "King", 2002, "full-time");
staff[3] = new Employee("james", "King", 2005, "temporary");
staff[4] = new Faculty("kate", "jakie", 2009,"part-time", "E104");
staff[5] = new Faculty("Rita", "Rose", 2009,"full-time", "E107");
staff[6] = new Admin("abel", "King", 2000,"temporary", 5);
staff[7] = new Admin("cain", "fingles", 2001,"part-time", 5);
for(int i = 0; i < staff.length; i++)
{
System.out.print(staff[i].makeEmail()+ "\n");
// Java determines which makeEmail() method to use
//because the other classes overrides the makeEmail() from the abstract Person
// and the override methods allows java to use the
//override method specofied in eash class.
}
Arrays.sort(staff);
for(int i = 0; i < staff.length; i++)
{
System.out.print(staff);
}
}
This post has been edited by pbl: 01 March 2010 - 06:23 PM
Reason for edit:: Code tags fixed :code:

New Topic/Question
Reply
MultiQuote










|