Java Program Help

Discussion in 'Software' started by thagentleman, Feb 16, 2006.

  1. thagentleman

    thagentleman Private E-2

    I need help getting nested statements to work. There seems to be a problem with being able to convert the input. I started learning Java 2 days ago so I am a newb but I have programmed in C++ for a couple of years. It says it cannot convert string to booleen. This is also an applet.




    import javax.swing.JOptionPane; // import class JOptionPane

    public class Password
    {


    public static void main( String args[] )
    {
    String casino;
    Object bet;
    String option;
    int number1;
    int number2;
    int number3;
    String firstnumber;
    String secondnumber;
    String thirdnumber;




    // read in first number from user as a string
    casino = JOptionPane.showInputDialog( "Enter password" );

    if
    (casino==casino)
    {
    JOptionPane.showMessageDialog(null,
    "Incorrect Password"
    );

    if(casino.equals(casino))
    {
    option = JOptionPane.showInputDialog("Enter an Option");
    number1 = Integer.parseInt(firstnumber);

    if(option=1)
    {
    JOptionPane.showMessageDialog(null,"You have $500");
    }
    if(option=2)
    {
    JOptionPane.showMessageDialog(null, "You have $500, Enter your bet");

    }
    bet=JOptionPane.showInputDialog(bet);
    if(bet<500)
    {
    JOptionPane.showMessageDialog(null,"Deal cards for Poker");
    }
    else
    JOptionPane.showMessageDialog(null,"You don't have enough money");
    }
    if(option=3)
    {
    JOptionPane.showMessageDialog(null,"Thank you for Choosing Java Casino");
    }
    }
    System.exit(0);
    }
    }
     
  2. Wookie

    Wookie Sergeant Major

    try

    casino = String(JOptionPane.showInputDialog( "Enter password" ));
     

MajorGeeks.Com Menu

Downloads All In One Tweaks \ Android \ Anti-Malware \ Anti-Virus \ Appearance \ Backup \ Browsers \ CD\DVD\Blu-Ray \ Covert Ops \ Drive Utilities \ Drivers \ Graphics \ Internet Tools \ Multimedia \ Networking \ Office Tools \ PC Games \ System Tools \ Mac/Apple/Ipad Downloads

Other News: Top Downloads \ News (Tech) \ Off Base (Other Websites News) \ Way Off Base (Offbeat Stories and Pics)

Social: Facebook \ YouTube \ Twitter \ Tumblr \ Pintrest \ RSS Feeds