h8. Program 3 Guess Number program Program description i need to write a java program named Guess_A_Number that plays a game in which the program

what is the best leadership strategies to use for leading a team with five members in a small company with various skills and personality?
September 9, 2020
RE: Unit VII Discussion Board Art Appreciation
September 9, 2020

h8. Program 3 Guess Number program Program description i need to write a java program named Guess_A_Number that plays a game in which the program

h8. Program 3

Guess Number program

Program description

i need to write a java program named Guess_A_Number that plays a game in which the program picks a secret number and the user tries to guess it.

The program first asks the user to enter the maximum value for the secret number.

Next, it chooses a random number that is >= 1 and<= the maximum number.

Then the user must try to guess the number.

When the user succeeds, the program asks the user whether or not to play another game.

The following example shows what the user will see on the screen (user input is in bold):

2. Input and output

Guess the secret number.

Enter maximum value for secret number: 10

A new secret number has been chosen.

Enter guess: 3

Too low; try again.

Enter guess: 8

Too low; try again.

Enter guess: 9

Too low; try again.

Enter guess: 10

You won in 4 guesses!

Play again? (Y/N) y

A new secret number has been chosen.

Enter guess: 7

Too high; try again.

Enter guess: 3

Too low; try again.

Enter guess: 5

You won in 3 guesses!

Play again? (Y/N) n

The user may enter any number of spaces before and after each input. The program should terminate if the user enters any input other than y or Y when asked whether to play again.

Hints

1) Use two while statement (nested) for the whole program. Maybe you can incorporate if statemement(s)

2) Use the following statement to pick the secret number:

int secretNumber = (int) (Math.random() * maxNumber) + 1;

3) Use trim() method to trim any number of spaces in an input.

4) Use the equalsIgnoreCase method to test whether the user entered y or Y.

Thanks for installing the Bottom of every post plugin by Corey Salzano. Contact me if you need custom WordPress plugins or website design.

The post h8. Program 3 Guess Number program Program description i need to write a java program named Guess_A_Number that plays a game in which the program first appeared on Submit Your Homeworks.


h8. Program 3 Guess Number program Program description i need to write a java program named Guess_A_Number that plays a game in which the program was first posted on September 9, 2020 at 4:02 pm.
©2019 "Submit Your Assignment". Use of this feed is for personal non-commercial use only. If you are not reading this article in your feed reader, then the site is guilty of copyright infringement. Please contact me at support@termpaperswriter.com

 

"Is this question part of your assignment? We Can Help!"

Essay Writing Service