To answer the Free Response Question #1, one can write the following code:
/**
* Postcondition: Prints all notes in noteList, one per line.
* Notes are numbered 1, 2, ...
* Each number is followed by a period and a space.
*/
public void printNotes()
{
for(int n = 0; n <= noteList.size() - 1; n++)
{
System.out.println(n + 1 + ". " + noteList.get(n).toString());
}
}
To answer the Free Response Question #2, one can (again) write the following code:
public class PartTimeEmployee extends Employee
{
private double workFraction;
private boolean isUnionMember;
public PartTimeEmployee(String name, String city, boolean isCitizen, double salary, double work, boolean isMember)
{
super(name, city, isCitizen, salary);
workFraction = work;
if(salary > 15000)
{
isMember = false;
}
else
{
isMember = true;
}
}
public double getWork()
{
return workFraction;
}
public boolean getMemberStatus()
{
return isUnionMember;
}
}
−Phoenix
This definitely works, well done. 150 XPs awarded.
ReplyDelete