Hi Everyone,
I'm just starting out on Java, and i've got stuck in one of my programs. Basically I'm trying to create a loop that counts the number of instances a candidate passes different exams. I've been playing with it to try and make some progress but all I have at the moment is:
public int getCountPassMarks()
{
int passCount = 1;
do
{
if (examMarks.readInt() >= 40) passCount++;
if (examMarks.finished()) dataFinished = true;
}
while (!dataFinished);
return passCount;
}
What i'm intending for it to do is every time it reads a mark that is greater that 40 it adds 1 to my counter variable, and then I can return the variable at the end to give the value, but I just can't get it to work. Any ideas?
Thanks for the help!