Fix please
DeliciousBurger (0)

If anyone could fix my code so if the input is equal to a list it will print out the message below it. https://repl.it/@DeliciousBurger/MildHeftyCell

You are viewing a single comment. View All
vedprad1 (694)

First of all, you should delete import java.util.S because you do not need it.
Second, you are messing up good list, badlist, and username. This is what you wrote in the contains() part:

if (username.contains(goodlist)){
    System.out.println("Good for you");
 }
if (username.contains(badlist)){
    System.out.println("Get better");
}

But you are not checking if the username contains the list. You are checking that the list contains the username, like this:

if (goodlist.contains(username)){
    System.out.println("Good for you");
 }
else if (badlist.contains(username)){
    System.out.println("Get better");
}

Also add else if for the second one. Less complexity.

If this answers your question, please check the checkmark on the left side of this message. Thanks and Good Luck!