Trying to write a program that asks the user if they want instructions. If the user enters maybe the console responds with "please enter a yes or no answer" and repeats the question.
I'm having difficulty listing the method parameters for the method askYesNoQuestion. Are the parameters simply String yes, String no? I am also stuck on how do I make the program repeat the question after someone enters maybe? Does my code look generally correct for what I'm trying to do?
import acm.program.*;
public class Instructions extends ConsoleProgram{
public void run(){
String answer = readLine("Would you like instructions? : ")
{
if (answer.equals("maybe")) {
println ("Please enter a yes or no answer.");
}
}
}
private boolean askYesNoQuestion(String yes, String no ){
if (askYesNoQuestoin ("would you like instructions? "))
if (answer.equals("yes")) {
return yes;
} else {
if (answer.equals("no"))
return no;
}
}