nevermind i figured it out
Printable View
nevermind i figured it out
Read the API doc for the String class. There are many methods there that will be useful to you.
Java Platform SE 6
Can you recommend anything. I know how to make the string all lowercase. It is just that I don't know how to tell the program to accept the all lowercase answer as correct
Click on norms link, Ctrl F and search for 'case', and cycle through the results.
nevermind i figured it out
If you'll explain what that method is supposed to do, maybe someone can tell you what it does.Quote:
I know how to make the string all lowercase, I am having a problem telling the program to accept it. This is what I have, can somebody PLEASE tell me what I am doing wrong.
public boolean isRightPlayer(String player, String Nickname) {
boolean isRightPlayer = false;
if (player == player.toLowerCase() && nickname == nickname.toLowerCase())
isRightPlayer = true;
return isRightPlayer;
}
One quick way to find out is to test it. Call it with many different types of Strings and observe the results and see if they are what you want.
nevermind i figured it out
Code :private static void Correctly() { setup(); if (!team.isRightPlayer("KeiTh SMITH", "hammer")) System.out.println("Incorrectly case-rejected show: Keith"); if (!team.isRightNickname("HAMMER", "kEItH smith")) System.out.println("Incorrectly case-rejected star: Keith");
Please show some examples. Something like:Quote:
can't get the code to see that the two names are the same
Then post the results and explain which should be true and which should be falseCode :System.out.println("test1: " + team.isRightPlayer("KeiTh SMITH", "hammer"));
Can you answer these questions about the isRightPlayer() method
It will return true if ....
It will return false if ....
replace the ... with the condition(s) that describe when that value will be returned