Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialAhmed Alfatih
Courses Plus Student 598 Pointswhere is the mistake
line 8
public class ConferenceRegistrationAssistant {
public int getLineFor(String lastName) {
/* If the last name is between A thru M send them to line 1
Otherwise send them to line 2 */
if ('A' < lastNmae.chars < 'M' )
{
int line = 1 ;
}
else
{
int line = 2;
}
int line = 0;
return line;
int line = 0;
return line;
}
}
2 Answers
Carlos Federico Puebla Larregle
21,074 PointsYou don't have to use ".chars" as a property, the "hint" is telling you that characters can be compared with those operators. You can use the method "str.charAt(0)" to see if the strings starts with a given letter:
public class ConferenceRegistrationAssistant {
public int getLineFor(String lastName) {
/* If the last name is between A thru M send them to line 1
Otherwise send them to line 2 */
int line = 0;
if (lastName.charAt(0) < 'M') {
line = 1;
} else {
line = 2;
}
return line;
}
}
I hope that helps a little bit.
Ahmed Alfatih
Courses Plus Student 598 Pointsyp , it does thank you
Jeremy Hill
29,567 PointsIt looks like your variable lastName is spelled incorrectly.
Jeremy Hill
29,567 PointsJeremy Hill
29,567 PointsYou do not need to keep declaring the variable every time you write it. If you use a local variable inside a method just declare and initialize it once like: int line = 0; Then afterwards within the same method you can just write: line = 2; for example.