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 trialCsaba Koles
4,644 PointsCan't figure out the conference challenge. Any suggestions what am I missing?
I'm facing this challenge for a while now and I have no errors. Any suggestion would be welcome!
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;
char firstLetter = lastName.charAt(0);
//boolean isFirstLine = lastName.indexOf('A') >= 'M';
if(firstLetter >= 'M'){
line = 1;
}
else{
line = 2;
}
return line;
}
}
2 Answers
Dan Johnson
40,533 PointsYou have the line numbers backwards:
// A-M closed range so M is included
if(firstLetter <= 'M') {
line = 1;
}
else {
line = 2;
}
Csaba Koles
4,644 PointsThank you very much, I knew it must be something I just overlooked! :)