Please help with assignement

ok so i have this assignment and im nearly 80 % done. here's what i have to do: Play a number guessing game. This game is to have the computer pick a number

between 1 and 30. Take this number, and pass it into a method that allows for the user

to guess it. Let the computer tell the user to pick a higher or lower number if they guess

wrong. If the guess is right, use another method to pick one of 3 random responses

congratulating them.

here is my code so far:

import java.awt.*;

import hsa.Console;

publicclass CPTaa

{

static Console c;// The output console

publicstaticvoid main (String[] args)

{

c =new Console ();

int dice1, dice2, dice4, dice5, num;

double dice3;

dice1 = (int) (Math.random () * 100) + 1;

c.print (dice1);

dice2 = 0;

num = 100;

for (int i = 0 ; i < num ; i++)

{

c.print ("Enter a number from 1 to 100: ");

dice2 = c.readInt ();

if (dice2 > dice1)

c.print ("Smaller ");

if (dice2 < dice1)

c.print ("Higher ");

if (dice1 == dice2)

{

c.print ("You got it right");

}

}

}

}

i need to do the 3 random congratulations part

[2180 byte] By [halo2ringa] at [2007-11-27 7:36:57]
# 1
Put the 3 congratulations messages into an array of Strings.Then use java.util.Random.nextInt to randomly choose an index from the array.Grab the string at that index and print it.
paulcwa at 2007-7-12 19:17:29 > top of Java-index,Java Essentials,Java Programming...
# 2

> ok so i have this assignment and im nearly 80 % done.

> here's what i have to do: Play a number guessing

> game. This game is to have the computer pick a

> number

> between 1 and 30. Take this number, and pass it into

> a method that allows for the user

> to guess it. Let the computer tell the user to pick a

> higher or lower number if they guess

> wrong. If the guess is right, use another method to

> pick one of 3 random responses

> congratulating them.

>

Follow your specs and create some methods. Do not cram everything into the main method. Also the specs say from 1 to 30 but you have 1 to 100.

floundera at 2007-7-12 19:17:29 > top of Java-index,Java Essentials,Java Programming...
# 3
For that matter...you're importing java.awt classes, but you don't see to be using any. That won't effect the final class file...but are you planning to add a GUI, or not? If you are, then you'll definitely want to create the methods implementing the game with flexibility in mind.
paulcwa at 2007-7-12 19:17:29 > top of Java-index,Java Essentials,Java Programming...