Starting from:

$30

Assignment 2 Random Number Guesser

CMSC 203 Assignment 2


Random Number Guesser



Build an application that will receive a guess and report if your guess is the random number that was generated.  Your application will narrow down the choices according to your previous guesses, and continue to prompt you to enter until you guess correctly.  
Notice that if you divide the choices in half each iteration, you will need at most log2(100) ~ 7 guesses. 
You will use the utility class RNG.java. 




•    A driver and a utility class 
•    UML class diagrams or pseudo-code
•    Java fundamentals, including decision structures, loops 
•    Selection control statements
•    Repetition control statements
•    Input validation loops (in RNG.java)
•    Relational and logical operators
•    Random number generation (in RNG.java)
  





Data Element Class – RNG 
•    Provided
•    This file will generate a random number between 1 and 100
•    Note that the method “rand” is a static method, so the java file does not need to be instantiated to use it.  Call rand with the following: RNG.rand(100) to generate a random number between 0 and 99.
•    Study this class.  You will want to use four methods from this class: rand, resetCount, getCount and inputValidation.

Driver Class – RandomNumberGuesser
•    Student created
•    This is the driver class for RNG that contains a main method.
•    The driver is responsible to:
o    print a header
o    ask the user for an initial guess of the Random Number between 0 and 100.
o    Print out the result for that guess using the methods from the RNG class. 
o    Allow user to give another guess between the previous low and high guesses.
o    Display the number of guesses 
o    When user guesses correctly, ask if the user wants to try another round.
o    Print the Programmer's name at the end
o    Refer to the program sample run for more clarification.
o    For testing, you may print out the randomly-generated number.
o    In comments, list the author’s name (yours)
•    Data Validation. The following data is validated by the RNG method inputValidation:
o    Guesses must be an integer between the previous low guess and high guess.
•    Naming.
o    There should be an attribute named randNum
o    There should be attributes named nextGuess, highGuess, and lowGuess
•    Add any necessary methods to modularize your code. 





Your program should respond similar to the following sample runs:
== Example Run 1 (one iteration) ===========
 
== Example Run 2 (one iteration, one guess over the limit) =========== 
== Example Run 3 (two iterations) =========== 
Take screenshots of two runs of your program. Your runs should include feedback on previous low and high guesses, at least one example of a guess not within the previous low and high guesses, and an example of a second try with a new random number.  You may use either an IDE or command-line processing. Store your files in the repo you created in GitHub in Lab 1, and take a screenshot of the GitHub repo.






Deliverables / Submissions: 
Design: UML class diagram or pseudo-code (algorithm)
Implementation: Submit a compressed file containing the follow:  The Java application (it must compile and run correctly); Javadoc files in a directory; a write-up as specified below.  Be sure to review the provided project rubric to understand project expectations.  The write-up will include:  
•    Screenshots of at least two runs of your code. Your runs should include feedback on previous low and high guesses, at least one example of a guess not within the previous low and high guesses, and an example of a second try with a new random number.
•    Final design: UML diagram or pseudo-code (revised from initial design if necessary) – as part of write-up or submitted separately, as desired.
•    In three or more paragraphs, highlights of your learning experience
•    Screen shot of Java code in your GitHub repo
     
Deliverable format: The above implementation deliverables will be packaged as follows. Two compressed files in the following formats:
•    LastNameFirstName_Assignment2_Complete.zip, a compressed file in the zip format, with the following:
•    Write up (Word document) - reflection paragraphs, screenshots
•    Final design: UML Diagram or pseudo-code (Word or image document)
•    src (directory)  
•    RandomNumberGuesser.java
•    RNG.java

•    LastNameFirstName_Assignment2_Moss.zip, a compressed file containing one or more Java files:
•    RandomNumberGuesser.java
This folder should contain Java source files only for files you generated

More products