import java.math.BigDecimal; public class TestPersonnelSimple { public static void main (String[] args) { // Each class has a 1-argument constructor Person pTest = new Person("Primus Valerius"); Student sTest = new Student("Secundus Valerius"); Employee eTest = new Employee("Tertius Valerius"); Faculty fTest = new Faculty("Quartus Valerius"); Staff tTest = new Staff("Quintus Valerius"); // Classes do NOT have default constructors // If any of the following lines are uncommented, // they should produce a compile time error // Person pTest2 = new Person(" "); // Student sTest2 = new Student(" "); // Employee eTest2 = new Employee(" "); // Faculty fTest2 = new Faculty(" "); // Staff tTest2 = new Staff(" "); // All classes inherit from Person Person[] people = new Person[5]; people[0] = pTest; people[1] = sTest; people[2] = eTest; people[3] = fTest; people[4] = tTest; // All classes provide toString, getID, getName, ticketLottery, getSeat for (int i = 0; i < 5; i++) { String value = people[i].toString(); } for (int i = 0; i < 5; i++) { int value = people[i].getID(); } for (int i = 0; i < 5; i++) { String value = people[i].getName(); } for (int i = 0; i < 5; i++) { people[i].ticketLottery(); } for (int i = 0; i < 5; i++) { StadiumDeck value = people[i].getSeat(); } // Employee, Faculty, Staff salaries are set with setSalary eTest.setSalary(new BigDecimal("10000")); fTest.setSalary(new BigDecimal("20000")); tTest.setSalary(new BigDecimal("30000")); // Employee, Faculty, Staff salaries are adjusted with giveRaise eTest.giveRaise(.01f); fTest.giveRaise(.02f); tTest.giveRaise(.03f); // Employee, Faculty, Staff salaries returned by getSalary BigDecimal dollars; dollars = eTest.getSalary(); dollars = fTest.getSalary(); dollars = tTest.getSalary(); // Students can choose an arbitrary advisor from an array of Faculty Faculty[] m_status = new Faculty[3]; m_status[0] = new Faculty("Alpha"); m_status[1] = new Faculty("Beta"); m_status[2] = new Faculty("Gamma"); Student freshman = new Student("Sir John. A. Macdonald"); freshman.chooseAdvisor(m_status); int advisor1 = freshman.getAdvisorID(); freshman.chooseAdvisor(m_status, "Beta"); int advisor2 = freshman.getAdvisorID(); // Faculty can find their advisees Student[] enrolled = new Student[3]; enrolled[0] = new Student("Spider-Man"); enrolled[1] = new Student("Wonder Woman"); enrolled[2] = new Student("Random Superhero"); for (int i = 0; i < 3; i++) { enrolled[i].chooseAdvisor(m_status); } for (int i = 0; i < 3; i++) { m_status[i].findAdvisees(enrolled); int count = m_status[i].getAdviseeCount(); } } }