lundi 4 septembre 2017

How to make this program say

I have a fairly simple question that will probably make you all laugh. I got this Java for Dummies book and it asks me to Modify the program so that if the user clicks Cancel for either the user or the password, the program replies with "Not enough information" Here's the code:

        if (

            (username != null || password != null) && 

        (   
        (username.equalsIgnoreCase("2nite") && password.equals("swordfish"))
        ||

        (username.equalsIgnoreCase("hritter") &&
            password.equals("preakson"))
        ||

        (username.equalsIgnoreCase("2nit3") && password.equals("havefaith1"))

        )

    ) 

    {
        JOptionPane.showMessageDialog(null, "You're in.");

    } else {

        JOptionPane.showMessageDialog(null, "You're suspicious.");
    }

I've been on it for more time then I'd like to admit and would like to move on but it's bothering me because I feel like this is my first actual problem to solve. This is my first time on here, if you could give me at least a hint, I'd be more than grateful. Thank you.

Aucun commentaire:

Enregistrer un commentaire