think of a number and allow the user to guess it
import java.util.*;
public class ThinkNumber
{
public static void main (String args[])
{
//generate number in range 1 - 100
//prompt user to enter guess
//loop until correct number is guessed
//check guess and output hint
//guess is correct - output count
}
}
I currently have this..
import java.util.*;
public class NewClass1{
public static void main (String args[]){
int randomNumber = new Random().nextInt(100) + 1;
System.out.println(randomNumber);
Scanner input=new Scanner(System.in);
System.out.print("Enter number to guess: ");
int num=input.nextInt();
while(num!=randomNumber){
System.out.print("Wrong! Again Guess: ");
num=input.nextInt();
}
System.out.println("Correct!!!!!!!");
}
}
dont know if someone could help if so that would be great!