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 trialShivang Chaturvedi
2,600 PointsI need some help in this challenge. Can't get through!!
Can anyone help me with the command line for this challenge with an explanation? Thanks in advance.
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;
return line;
}
}
Shivang Chaturvedi
2,600 PointsHi Rob,
I really appreciate your quick response. Will try to work things out with what you have suggested. Please do reply back once you get back home. Have a happy working day!! :)
Shivang Chaturvedi
2,600 PointsHey Rob,
It worked out fine. Finally did it. Thanks a ton!!
Rob Bridges
Full Stack JavaScript Techdegree Graduate 35,467 PointsHey there!
Glad to hear it worked out.
1 Answer
J.D. Sandifer
18,813 PointsUse .charAt(0) on a String to get the first letter. This can be compared with other letters as required to sort the Strings.
Rob Bridges
Full Stack JavaScript Techdegree Graduate 35,467 PointsRob Bridges
Full Stack JavaScript Techdegree Graduate 35,467 PointsHey Shivang I just started at work but I'll answer this more in depth when I get home.
Remember that we can compare the first character in words with.
lastName.charAt(0) < "M"
We can put this in an if statement and move them to the correct line. So if the above line of code is true. They'd go to line. 1 sorry I can't type the whole thing out on my phone.