![]() |
| ||
| Hw help please can someone help me with this HW the instructions are : # The computer should ask the player for the largest possible value which could be generated (N) # The maximum number of guesses should be set equal to 1/2 N. (Don't prompt the user). # When the game starts, the top 5 high scores should be displayed. * At the beginning of a round, the high scores will be read from a file into an array o You can decide where this file is to be stored. You DON'T need to prompt the user to find it. o Tip: If you wish to use relative paths for your file location... it can be tricky. * The High-Scores should be displayed in descending order. * The high-score file just contains a series of integers. o For simplicity, no other information will be stored.... just the scores themselves. o (See the sample file below) # The player should be asked to guess a number between 1 and N. * The user should receive feedback pertaining to whether their guess is too high or too low. # The player should be able to enter guesses until: * The correct number is guessed * The guess limit is reached * The user enters a negative number to quit the round. # Once a round is quit, the player should be prompted to play another round. # Once a round ends: * The player should be shown their score using the following formula: o Score = (Maximum Value) / (Number of Guesses to get Correct) o Score = 0 if the user quits before getting the correct answer or exceeds the maximum number of guesses. o Round the score to the nearest integer * If the players score is higher than the lowest score in the "high-score" file: o A new high-score file should be written over the old one. # The user should be prompted to play again. * The should be able to answer in upper or lower case * The continued game should use the same upper bound and max guesses as entered at the beginning. * Before staring the each round, the current high scores should be displayed. Here wat i have done so far: import java.io.*; |
| ||
| Re: Hw help First please help us try to help you by :-
|
| ||
| Re: Hw help import java.io.*; and here is an example of wat im tryin to get it to do : Initial Input: Game Setup: I will pick a random number between 1 and N. Please enter a value for N: 100 Game Play Input/Output: High Scores: 15 10 10 5 3 I am thinking of a random number between 1 and 100. Enter -1 at any time to quit. Enter guess number 1: 50 Your guess is too high. Enter guess number 2: 10 Your guess is too low. (... The game continues ... ) Enter guess number 50: 45 Congratulations, you guessed the correct value in 50 tries! You scored is 2 points. You did not beat a high score. Would you like to play again (Y/N)? Y |
| ||
| Re: Hw help Yes but again where is it that you are getting stuck up ? Don't expect us to form the logic for you since you know what's to be done, you should be able to deduce a correct logic for that and write the code for it, then if you are getting stuck at any particular place ask us specific questions about it. |
| ||
| Re: Hw help First of all you need a class to represent each 'game'. The class would contain the following data: int correctNumber; int guessesAllowed; int guessesLeft; You might need a few more things. You also need to split each task into methods. For example, prompting the user for their guesses could be one method; generating the random number that you want them to guess could be another method; etc |
| ||
| Re: Hw help yea i have a hard time breaking things up into methods. can someone please help me out with that? |
| All times are GMT -4. The time now is 5:49 am. |
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC