thetree718
2009-04-24 11:57:47 UTC
also im aware that the "int n1= generator..." gives me the error n1 is defined in main(java.lang.string[]). i dont know how to fix it.
import java.util.Scanner;
import java.util.Random;
public class gamez
{
public static void main(String args[])
{
int n1, n2, n3, n4, choice = 1;
System.out.println("I want to play a game...");
while (choice == n3)
{
int n1 = generator.nextInt(100) + 1;
System.out.println("What number am I computing of?(1-100)");
n2 = input.nextInt();
if(n2 == n1)
{
System.out.println("Man you are good!");
}
else if (n2 > n1)
{
System.out.println("Thats too high, guess lower");
}
else if (n2 < n1)
{
System.out.println("Thats too low, guess higher");
}
System.out.println("Game Over, Good Job");
System.out.println("Play again? (Yes = 1, No=2)");
n3 = input.nextInt();
if(n3 == 1)
{
}
{
System.out.println("Aww ok :P");
}
System.out.println("Good game, join me again later and I'll compute a new number just for you");
}
}
}