Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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.

How....or instruction

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.

Mehtod is gone be like the way....

There are a many ways to parse your input, but only a few that are easy. Here are a few different suggestions. Only use Scanner.nextLine() to read in input. Using Scanner.nextInt() and Scanner.nextLine() together will lead to confusion. String.split() is useful for breaking apart strings seperated by delimiters, such as commas, or, in this program, spaces. How do I tell what the string the user input is? Check either if its the word answer or a sequence of numbers. Regular expressions are also useful here, if you know how to use them.1 Break up individual tasks into methods. For example you can have one method to grab user input, another method to detect whether a guess follows a rule, and so forth.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

Explain the mixed technique for forecasting exchange rates.

Answered: 1 week ago

Question

How to find if any no. is divisble by 4 or not ?

Answered: 1 week ago

Question

Explain the Pascals Law ?

Answered: 1 week ago

Question

What are the objectives of performance appraisal ?

Answered: 1 week ago

Question

What is the difference between Needs and GAP Analyses?

Answered: 1 week ago

Question

What are ERP suites? Are HCMSs part of ERPs?

Answered: 1 week ago