eyabb
2012-03-23 11:55:06 UTC
/*
* Random number generator
*
* Pseudo-code: (pronounced SOO-DOH CODE)
* declare variables
* initialize variables
* generate a random number "r"
* print a startup message/splash screen
*
* print a prompt
* read line
* change line into an int called "g", for example, using Integer.parseInt
* while "g" != "r" number
* if "g" < "r"
* ?
* else
* ?
* add one to guesses taken
* print a prompt
* read line
* change line to guessed int "g" using Integer.parseInt
* end while
*
* print results based on number of guesses
*/
import static java.lang.System.out;
import java.util.Random;
import java.util.Scanner;
public class Main
{
/**
* The random number generated.
*/
static Random randomObject;
static int randomInt;
/**
* A line of input text.
*/
static String line;
/**
* The user's guessed number.
*/
static int guessed;
/**
* The count of the total number of guesses required.
*/
static int guessedCount;
/**
* Connection to standard input (viz., the keyboard)
*/
static Scanner scanner;
public static void main(String[] args)
{
// FOR STUDENT TO COMPLETE
// startup message
// FOR STUDENT TO COMPLETE
// initialize variables
// including generating a random number
// FOR STUDENT TO COMPLETE
// prompt for and read a guess as a String
// and change into an int using guessed = Integer.parseInt(line);
while ( guessed != randomInt ) {
// FOR STUDENT TO COMPLETE
// see pseudo-code
// FOR STUDENT TO COMPLETE
// prompt for and read a guess as a String
// and change into an int using guessed = Integer.parseInt(line);
}
// FOR STUDENT TO COMPLETE
// summarize results
// print exit message
out.println("\n\nThanks for visiting the Numberdini");
}
}