ClubMembers free response problem from the 2021 AP Computer Science A Exam.
ClubMembers is #3 from the from the 2021 AP Computer Science A Free Response problems.
https://apcentral.collegeboard.org/pdf/ap21-frq-computer-science-a.pdf?course=ap-computer-science-a
Part (a) – addMembers method
public void addMembers(String[] names, int gradYear)
{
for(String name : names)
memberList.add(new MemberInfo(name, gradYear, true));
}
Part (b) – removeMembers method
public ArrayList<MemberInfo> removeMembers(int year)
{
ArrayList<MemberInfo> goodStanding = new ArrayList<MemberInfo>();
int i = 0;
while(i < memberList.size())
{
if(memberList.get(i).getGradYear() <= year)
{
MemberInfo removed = memberList.remove(i);
if(removed.inGoodStanding())
goodStanding.add(removed);
}
else
i++;
}
return goodStanding;
}
Hello, do you know how many points we would potentially lose if we failed to add the gradYear and the boolean parameter for part A? I have an example of what I mean below.
public void addMembers(String[] names, int gradYear)
{
for(String name : names)
memberList.add(new MemberInfo(name);
}
My guess would be 1 point. You’ll have to wait until the scoring guidelines are released for an official answer.