lonely
01-17-2012, 09:21 PM
Im trying to make a a program that operates almost like a slot machine and this is what i have so far. im having a bit of trouble with the "if" statments so can someone tell me what i did wrong. also it wont let me add "else if" to the second "if"
import java.io.*;
class SlotGame
{
public static void main (String[] args) throws IOException
{
BufferedReader myInput = new BufferedReader (new InputStreamReader(System.in));
String inName;
String inanswer1;
System.out.println ("Please Input Your Name");
inName = myInput.readLine ();
System.out.println (inName + ",Welcome to the Slot Game!");
System.out.println (inName + " Would you like to play?(y/n)");
inanswer1 = myInput.readLine ();
if (inanswer1.equals("y"));
System.out.println ("Lets Play!");
else if (inanswer1.equals("n"))
System.out.println ("GAME OVER");
}
}
import java.io.*;
class SlotGame
{
public static void main (String[] args) throws IOException
{
BufferedReader myInput = new BufferedReader (new InputStreamReader(System.in));
String inName;
String inanswer1;
System.out.println ("Please Input Your Name");
inName = myInput.readLine ();
System.out.println (inName + ",Welcome to the Slot Game!");
System.out.println (inName + " Would you like to play?(y/n)");
inanswer1 = myInput.readLine ();
if (inanswer1.equals("y"));
System.out.println ("Lets Play!");
else if (inanswer1.equals("n"))
System.out.println ("GAME OVER");
}
}