Question: Which XXX completes the following code? import java.util.Scanner; public class GuessMyAge { public static void myGuess ( int low, int high, Scanner scnr ) {

Which XXX completes the following code?
import java.util.Scanner;
public class GuessMyAge {
public static void myGuess(int low, int high, Scanner scnr){
int mid;
char userAnswer;
mid =(low + high)/2;
System.out.print("Is it "+ mid +"?(</>/=): ");
userAnswer = scnr.next().charAt(0);
if ((userAnswer !='<') && (userAnswer !='>')){
System.out.println("Great!");
}
else {
if (userAnswer =='>'){
XXX
}
else {
myGuess(low, mid, scnr);
}
}
}
public static void main(String[] args){
Scanner scnr = new Scanner(System.in);
myGuess(0,100, scnr);
}
}
a.
myGuess(mid +1, high, scnr);
b.
myGuess(low, mid, scnr);
c.
myGuess (mid, high, scnr);
d.
myGuess (low, high, scnr );

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 Databases Questions!