Students and I came up with the same code as the Example solution, but cannot pass the Test.
I tested the Example solution1 code and it could not pass the Test either.
Please advise - thanks!
Students and I came up with the same code as the Example solution, but cannot pass the Test.
I tested the Example solution1 code and it could not pass the Test either.
Please advise - thanks!
@williamsj1 - Thanks for posting about this issue. Could you please post a image of the code you are using?
Thanks,
Sylvia
Hi,
This is CSA('23-'24)
The Example Solution1 code is as follows
/* ----------------------------------- TO DO -----------------------------------
*/
public void addServiceHours(ClubMember member, int numHours) {
member.setServiceHours(member.getServiceHours() + numHours);
}
/*
for (ClubMember student : members) {
text = text + student + “\n”;
}
return text;
}
The Example Solution1 Runner code is:
/* ----------------------------------- TO DO -----------------------------------
*/
// Calls the addServiceHours
sponsor.addServiceHours(naomi, 7);
sponsor.addServiceHours(ariana, 4);
// Prints the updated ClubSponsor object
System.out.println(sponsor);
}
The Test results are:
[JAVALAB] Connecting…
[JAVALAB] Compiling…
[JAVALAB] Compilation successful.
[JAVALAB] Running level tests…
ClubSponsor.java Test > addServiceHours() has a parameter for a ClubMember object => SUCCEEDED
ClubSponsor.java Test > addServiceHours() has a parameter for the number of hours to add => SUCCEEDED
ClubSponsor.java Test > addServiceHours() has a void return type => SUCCEEDED
ClubSponsor.java Test > addServiceHours() adds the specified number of hours to the ClubMember object’s service hours => FAILED
Call the getServiceHours() method in the ClubMember class to get the current service hours. Add the
parameter for the number of hours to the current service hours and update the ClubMember object’s
serviceHours instance variable with the new value using the setServiceHours() method.
==> expected: <24> but was: <15> (ClubSponsorTest.java:90)
[JAVALAB] Program completed.
Hope that helps!
Jayne
@williamsj1 - Thank you for the information. I am also seeing the same failed test. I will pass this on to the curriculum team. We appreciate you posting this bug and any others you may encounter. I will post any updates to this thread.
Sylvia