Question
Your task is to recreate this game in Java, albeit in a simpler, text-based format. The player enters sequences of three numbers to see if
Your task is to recreate this game in Java, albeit in a simpler, text-based format. The player enters sequences of three numbers to see if they follow the hidden rule. When the player has entered their sequence, the program should reply whether or not the sequence followed the rule. You can use the same rule or create your own. Regardless, the game is played the same way. 2.1 How Create a loop which gives the player instructions on what to input. Then read input from the player. The input will be either one of two options: If the user enters the word answer or some other string you choose to indicate the player is ready to end the game and guess. In this case, prompt the user to guess our games rule, then output the answer. Advanced We can use the .contains() method to analyze the guess and our output accordingly: If the guess contains the string doubled or doubling or multiple, the guess if most likely wrong. If the guess contains the string increase or increasing, the guess is most likely right and you can tailor the output accordingly. Three numbers separated by spaces. If the user enters a sequence that follows the rules, output Yes! Otherwise output No.he
This is the way my instructor looking for
Thanks
String num;
do{ Scanner secan = new Scanner(System.in);
System.out.println("Please enter sequence number str: "); // it can be "123"
num = secan.nextLine(); // then read it
int reh=Integer.parseInt(num); // then convert it into integer
System.out.println(reh);
for(String retval: num.split("")){ // then split that
System.out.println(retval);
// ono loop and one method go insdie here which is calculate the number increasing order then print
}while(num.contains("answer"));
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started