Monday, September 8, 2008

September 8, 2008

Write a guessing game with Java where the user guesses a number between one and 100 and you give tips based on how close or far they are. If they are 20+ digits away you can laugh at them! If they are within 10-20, say they are within a decent range, otherwise say they are getting closer!

You may work with a classmate or two or by yourself.

When you are finished you may add the random number ability:

int ranNumber = (int)(Math.random()*100);

if(ranNumber > 50)
{
System.out.println(ranNumber + " is greater than 50");

}
else if(ranNumber > 25)
{
System.out.println(ranNumber + " is greater than 25");
}
else
{
System.out.println("Your number sucks!");
}

No comments: