java.io
I just posted this message and it seemed to dissapear >=(. SO here it is again. I made a program that asks for the users input. I make a random number then ask for the user to guese. Then it says higher or lower. It worked fine compiled and ran in the command prompt. But when i tried to run it online it didnt work. I think it said that it could not find java.io.
Heres the code
import java.io.*;
class numfun {
public static void main(String[] args) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
System.out.println("Welcome to num fun BETA");
System.out.println("What Do You Want To Do (1-3):");
System.out.println("1 Play Game");
System.out.println("2 Rules");
System.out.println("3 Exit");
int menuChoice = Integer.parseInt(in.readLine());
if (menuChoice==1) {
playGame();
}
}
static void playGame() throws IOException {
System.out.println("--");
System.out.println("Im thinking of a number from 1 to 100");
System.out.println("What if your guese");
numbertime();
}
static void numbertime() throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
int num = (int) (Math.random() * 100);
System.out.println("Choose Now");
int Choice = 0;
while (Choice != num) {
Choice = Integer.parseInt(in.readLine());
if (Choice < num) {
System.out.println("The number is higher");
} else if (Choice > num) {
System.out.println("The number is lower");
}
}
System.out.println("You WIN");
}
}
Heres the html:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Untitled</title>
</head>
<body>
<APPLET CODE="numfun.class" WIDTH=150 HEIGHT=25>
</APPLET>
</body>
</html>
did i do something wrong in the html or the code itself or did i have to compile it a cretain way.. Thanks for the help :)

