Abstract Classes Questions
Start with this example - you can work with a neighbor and submit by email to borlaj@portlandschools.org with subject line quiz22a.
Quiz22a (For all of these, you can put them in Bluej)
- What method/methods must a class that extends StaffMember override? (list all)
- What method/methods must a class that extends Employee override? (list all)
- If we had a Volunteer Lydia, what methods can you call on it?(list all)
- Explain what the first line of the constructor of hourly employee does.
- Explain what the line super.pay() does in the pay method of Executive.
- If you have a Volunteer Lydia and an Hourly employee named Elliot, what methods would you be able to call on both of them?(list all)
Together
import java.util.*;
public class HR
{
private ArrayList<StaffMember> allWorkers=new ArrayList<StaffMember>();
public HR()
{
StaffMember s1=new StaffMember("Jeff","36 Runnells","342-2343","053-62-0062",300);
allWorkers.add(new Employee("Elliot","34 park","234-2222","342-11-0343",500));
allWorkers.add(new Employee("Abukar","22 Main","359-8832","853-72-8672",350));
allWorkers.add(new Hourly("Wilder","219 Deering","981-9402","053-33-8312",12));
allWorkers.add(new Executive("Ahmed","45 Brighton","766-7767","323-03-2119",850));
allWorkers.add(new Volunteer("Lydia","1004 Forest","720-8847"));
}
}
|