&& Fill Fraction Solution (cont.)

Here is the continuation of the && solution. It requires a new grouping of if statements. I still recommend following along instructor’s method.

//&& SOLUTION
if (timerValue <= 0 && isAnsweringQuestion)
{
    timerValue = timeToReviewQuestion;
    isAnsweringQuestion = false;
}
else if (timerValue <= 0 && !isAnsweringQuestion)
{
    timerValue = timeToCompleteQuestion;
    isAnsweringQuestion = true;
    loadNextQuestion = true;
}


//FILL FRACTION (&& SOLUTION)
if (isAnsweringQuestion)
{
    fillFraction = timerValue / timeToCompleteQuestion;
}
else if (!isAnsweringQuestion)
{
    fillFraction = timerValue /  timeToReviewQuestion;
}

Privacy & Terms