Question: Use this method when answering the next 2 questions. public static int theValue ( ) { boolean notDone = true; int foundIt = - 9

Use this method when answering the next 2 questions.
public static int theValue()
{
boolean notDone = true;
int foundIt =-9;
do {
System.out.print("Enter score: ");
int cntScore = getInt(); //assume getInt() is defined to obtain an integer input from the user using a Scanner object
if (cntScore !=-99)
{
if ((cntScore >=0) && (cntScore <=100))
{
if (cntScore > foundIt)
foundIt = cntScore;
}
}
else
notDone = false;
} while (notDone == true);
return foundIt;
}
What is the sentinel value used in this method?

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!