Hey,
I'm new to Java and this forum. I have been reading the online book JavaNotes to learn Java, and I wrote this code. I couldn't figure out what was wrong with it using the book, except for that I knew I was probably using the wrong types (int, double, char, etc). I'm also pretty sure that Math.rnd(1-4) is not a correct command.
Will someone please help and expain? It would also be great if you could tell me how to get input that is text instead of numbers.
P.S: I am using a file called TextIO for my input. You can find it at the JavaNotes page.
Here is the code I wrote:
/* A program that chooses a suit and makes you guess it. */
public class Suits {
enum Suits{CLUB, SPADE, DIAMOND, HEART};
public static void main(String[] arg) {
double userInp;
int st;
userInp=TextIO.getlnInt;
st=Math.rndDouble();
System.out.print("I'm thinking of a suit. Can you guess it?");
while (userInp=st) {
System.out.print("You got it right!");
}
System.out.print("You got it wrong.");
} //end of main
} //end of class Suits