Question
This is in Java code Objective: The goal of this assignment is to get familiar with taking input using Scanner, processing input data, using conditionals,
This is in Java code
Objective: The goal of this assignment is to get familiar with taking input using Scanner, processing input data, using conditionals, and loops. Background: We will create a guessing game. We will ask the user if they want unlimited number of guesses or a certain number of guesses. Assignment: You will create a program that replicates the guessing game we worked on in the class. The program
1. Will ask the player two select one of two options: A guessing game with a. Unlimited number of guesses b. Limited number of guesses i. In this case, ask the user what limit they would prefer.
2. Will use a random number generator (Chapter 2.18) to generate one random number between 1 to 10. Lets call it a secret number. This number will be the number the player will try to guess.
3. For option 1(a) unlimited guesses, continue to ask the player for a number until they guess the right number. a. For each incorrect guess, provide a helpful message saying if the guess is low or high than the secret number. b. For the correct guess, print a message saying You guessed it right. The secret number is [x]. It took you [y] tries to get it right! where [x] is the secret number and [y] is the number of tries it took the player to guess the secret number.
4. For option 1(b) allow the player a limited number of guesses (based on the input in 1.b.i). a. For each incorrect guess, provide a helpful message saying if the guess is low or high than the secret number. b. For correct guess, print You guessed it right. The secret number is [x]. where [x] is the secret number. c. If the user runs out the number of guesses and cannot guess the cannot guess the correct number display Oops, sorry. The secret number was [x].
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered 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