I'm working on a Pig Latin method and now I'm trying to do the if-else statement: if Start word is capitalized, lowercase Start and uppercase End. This is so if a word is at the beginning of a sentence or is just capitalized in general (Ex. John), the Pig Latin will capitalize the first letter when translating (Ex. Ohnjay). I cannot figure out why my code won't work, maybe I'm not storing values correctly... I admit straight out>> this is for a homework assignment, if you don't like, don't answer<< Thanks for any help!
else if (vowel > 0)
{
Start = Input.substring(0, vowel);
End = Input.substring(vowel);
char StartFirstLetter = Start.charAt(0);
char EndFirstLetter = End.charAt(0);
if (Character.isUpperCase(StartFirstLetter) == true)
{
End = Character.toUppercase(EndFirstLetter);
}
else
{
Result = End + Start +"ay ";
}
here's the error:
StringUtil.java:175: error: cannot find symbol
End = Character.toUppercase(EndFirstLetter);
^
symbol: method toUppercase(char)
location: class Character
1 error
Ironically, the
c
needs to be in uppercase for thetoUpperCase
method: