2006 AP CSA FRQ 1: DailySchedule
Topic: ArrayList & Object Interaction
Skills Tested: ArrayList traversal, object method calls, removing while iterating, boolean logic
Curriculum Alignment: Unit 4 (Data Collections) (2025-2026 AP CSA)
Points: 9 | Time Estimate: ~22 minutes
Part (a)
Write the conflictsWith method that returns true if this appointment's time overlaps with another appointment's time.
Solution
public boolean conflictsWith(Appointment other)
{
return getTime().overlapsWith(other.getTime());
}
Part (b)
Write the clearConflicts method that removes all appointments from the schedule that conflict with the given appointment.
Solution
public void clearConflicts(Appointment appt)
{
int i = 0;
while (i < apptList.size())
{
Appointment listAppt = (Appointment) apptList.get(i);
if (appt.conflictsWith(listAppt))
apptList.remove(i);
else
i++;
}
}
Part (c)
Write the addAppt method that adds an appointment to the schedule, clearing conflicts first if it's an emergency.
Solution
public boolean addAppt(Appointment appt, boolean emergency)
{
if (emergency)
{
clearConflicts(appt);
apptList.add(appt);
return true;
}
for (int i = 0; i < apptList.size(); i++)
{
Appointment listAppt = (Appointment) apptList.get(i);
if (appt.conflictsWith(listAppt))
return false;
}
apptList.add(appt);
return true;
}Key Concepts
Common Mistakes to Avoid
Official College Board Resources
About the Author: Tanner Crow is a certified AP Computer Science teacher with 11+ years of experience.
Last updated: January 2026