6omba7la
12-10-2007, 06:17 PM
Hello everyone
my java gussing game dosent work and i dont know what the problem is please i would really appreciate the help thank you
import java.util.Scanner;
class Guess
{
public static void main (String[] args)
{
int random = 1 +(int)(Math.random() * 100);
Scanner guess = new Scanner (System.in);
int found = 0;
int answer;
int x=1;
answer = guess.nextInt();
do {
System.out.print("count is: " + random);
if ( answer > 100 )
System.out.println("\n" +answer+" is an invalid number.\n");
else if ( answer < x )
{
System.out.println("\nGoodbye\n");
found = 1;
}
else if ( answer < random )
System.out.println("\n Guess "+answer+" is LOW.\n");
}
else if ( answer > random )
System.out.println("\nGuess "+answer+" is HIGH.\n");
}
else if ( answer = x )
{
System.out.println("\nYou are right\n");
found = 1;
}
while ( random <= 101)
found <= 101;
System.out.print("thanks , bye");
{
{
{
my java gussing game dosent work and i dont know what the problem is please i would really appreciate the help thank you
import java.util.Scanner;
class Guess
{
public static void main (String[] args)
{
int random = 1 +(int)(Math.random() * 100);
Scanner guess = new Scanner (System.in);
int found = 0;
int answer;
int x=1;
answer = guess.nextInt();
do {
System.out.print("count is: " + random);
if ( answer > 100 )
System.out.println("\n" +answer+" is an invalid number.\n");
else if ( answer < x )
{
System.out.println("\nGoodbye\n");
found = 1;
}
else if ( answer < random )
System.out.println("\n Guess "+answer+" is LOW.\n");
}
else if ( answer > random )
System.out.println("\nGuess "+answer+" is HIGH.\n");
}
else if ( answer = x )
{
System.out.println("\nYou are right\n");
found = 1;
}
while ( random <= 101)
found <= 101;
System.out.print("thanks , bye");
{
{
{