hey everyone i'm trying to create a program where you pick a number between naught and fifteen to match a randomly generated number. here's what i have so far.
and here is the output i get/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package numberchoice; import java.io.*; import java.util.*; /** * * @author John */ public class Main { /** * @param args the command line arguments */ public static void main(String[] args) { char Choice = 0; // TODO code application logic here log("Pick a number between 0 and 15"); try{ Choice = (char)System.in.read(); }catch (IOException ioe){ System.exit(1); } Random randomGenerator = new Random(); int Random = randomGenerator.nextInt(16); log("The Number is: "+Random); if(Choice == Random){ log("You have won!"); }else{ log("You have lost."); } } private static void log(String aMessage){ System.out.println(aMessage); } }
could any body help me out with this?run:
Pick a number between 0 and 15
0
The Number is: 0
You have lost.
BUILD SUCCESSFUL (total time: 14 seconds)
cheers,
luke.