| 
  • If you are citizen of an European Union member nation, you may not use this service unless you are at least 16 years old.

  • You already know Dokkio is an AI-powered assistant to organize & manage your digital files & messages. Very soon, Dokkio will support Outlook as well as One Drive. Check it out today!

View
 

NumberGuess

Page history last edited by PBworks 16 years, 6 months ago

NumberGuess

In this code sample, you will have java choose a number at random, then ask for input from the user. Based on the input, the program will respond.

 

The way this is written, it is unlikely that you will actually get the number on the first try, 26 in 1 chance of getting it right. Make the code so that it is less frustrating for the user. Make it more entertaining and winnable.

 

Code the first sample. Make it run. Limit the scope of the choices. Make it so the user stands a chance of actually getting the answer.

 

Add a variation of this code to an existing program you have made this term?

Save the new code with a new name to preserve your original.

 

Upload your code to your wiki.

 

 

Code the second sample. Make it so the user has more than one chance at getting the answer. Have the code tell the user some hints about the correct answer. Tell the user it is odd, even, prime, higher than the guess, lower than the guess, etc.

 

 

 

This code gives the user some hint as to whether they guessed high or low

Comments (0)

You don't have permission to comment on this page.