Random Generating Number Problems
960425Sep 6 2012 — edited Sep 6 2012I have been working on this random number generation game were you have to guess a number between 0-15 and it wont run please help me to see what is wrong with my code.
import java.until.Random;
import java.until.Scanner;
public class Main
{
public static void main(String[] args)
{
System.out.print("input Number:");
// Get number between 0-15
int in = getInput();
//Generate Random Number
int val = getRandomNumber();
//Test if numbers are the same
if (in == val)
System.out.println("We Win");
else
System.out.println("We Lose");
System.out.println("our number:" + in);
System.out.println("Computers Number:" + val);
}
public static int getInput();
{
Scanner scan = new Scanner(System.in);
String temp = scan.next();
int res = Integer.parseInt(temp);
if (res < 0)
res=0;
if (res > 15)
res=15;
return res;
}
public static int `()
{
Random rand = new Random();
int res = rand.nextInt (16);
return res;
}
}