Guessing game – 20210627M

// You may use the nested comments below as hints only. Remember, there is no one right or wrong way // to ‘solve’ this Assignment, so feel free to delete the comments if you find them distracting. import java.util.Random; /** * CS1A, Assignment 4, “Guessing Game”
* Quarter:
* TODO: REPLACE THIS CAPITALIZED TEXT WITH THE DESCRIPTION OF THIS CLASS
* TODO: REPLACE THIS CAPITALIZED TEXT WITH THE DESCRIPTION OF HOW TO WIN MOST EFFICIENTLY
* * @author student name 1 * @author student name 2 * @author student name 3 */ public class GuessingGame extends Object { // List any instance variables, including constants, here. private static final int MAX_POSSIBLE_GUESS = 64; // This is a constant // Use an array instance variable to hold the guesses Random randomNumberGenerator = new Random(); // If you need to get a number for the user to guess (randomly), // call the method below and it will create one for you. // The number may be as low as -64, and as high as 64 // (This will be 129 separate numbers that the user might try to guess) // Of course, you will have to create a variable space to hold this number // when it is returned (for example, secretNumber) public int getRandomNumber() { int max = MAX_POSSIBLE_GUESS – MIN_POSSIBLE_GUESS; int zeroToMax = randomNumberGenerator.nextInt(max + 1); return zeroToMax + MIN_POSSIBLE_GUESS; } // You may want to create a method that will display the welcome message and // rules (e.g., welcome) // You may want to create a method (e.g., isGuessNum) that will check to see // that the number entered is a whole number, // assign it to a variable like userGuess, and then handle all // the various options regarding that number: has it been guessed before?; is it // the secret number?; if it isn’t the secret number store it in the proper // location for cross checking; display messages regarding the number of guesses // made, // incorrect guesses, guesses remaining, secret number if all guesses used up, // error handling, etc. // You may want to create a method to print the user’s previous guesses // You may want to create a method to store the user’s guesses in the 8 elements // of the array // You will NEED a getInput method for getting integer input from the user (see // the assignment instructions on applying the techniques of structured // (functional) decomposition)). // You may want to create a boolean method to check that the user’s guess is // within range (between a minimum and maximum) // and will return true if it is // You may want to create a boolean method to see if the number has been guessed // previously and will return true if it has // You may want to create a boolean method to see if the number matches the // secret number and will return true if it does or false if it doesn’t // You may want to create a method to give a hint about the number guessed // (e.g., “My secret number is GREATER than ” or “My secret number is LESS than // “) // You may want to create a method (e.g., playGame) that will check if the user // wants to play again, by calling the method for getting integer input from the // user, // (1 for ‘yes’, 0 for ‘no’) and incorporate the proper functionality depending // on the user’s choice ( 1 or 0). public void playGuessingGame() { int secretNumber = this.getRandomNumber(); // Feel free to move this into another method System.out.println(“Hello!”); // You might call a welcome() method here instead // You might create a loop here that will check numberGuesses 8 times and print // the guess number and call the // pertinent method (e.g., isGuessNum) // You might call and capture results from method (e.g., playGame) to see if // user wants to play again and if // so return it. Example: int playAgain = this.playGame(); return; // if you want to end the game early & go directly back to main, // you can use a “return;” statement like this one (e.g., return playAgain;) } } Requirements: 500-800

Place your order
(550 words)

Approximate price: $22

Calculate the price of your order

550 words
We'll send you the first draft for approval by September 11, 2018 at 10:52 AM
Total price:
$26
The price is based on these factors:
Academic level
Number of pages
Urgency
Basic features
  • Free title page and bibliography
  • Unlimited revisions
  • Plagiarism-free guarantee
  • Money-back guarantee
  • 24/7 support
On-demand options
  • Writer’s samples
  • Part-by-part delivery
  • Overnight delivery
  • Copies of used sources
  • Expert Proofreading
Paper format
  • 275 words per page
  • 12 pt Arial/Times New Roman
  • Double line spacing
  • Any citation style (APA, MLA, Chicago/Turabian, Harvard)

Our guarantees

Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.

Money-back guarantee

You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.

Read more

Zero-plagiarism guarantee

Each paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.

Read more

Free-revision policy

Thanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.

Read more

Privacy policy

Your email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.

Read more

Fair-cooperation guarantee

By sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.

Read more

Order your essay today and save 30% with the discount code HAPPY