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 trialRussell Brookman
3,118 PointsThey want me to put people into line one and two. If you can help that would be awesome. If not, I totally understand.
// This is as far as I get. Please tell me all the things I am doing wrong.
public class ConferenceRegistrationAssistant { private char theLines;
public 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; int line = 1; public boolean goToLine(char firstLetterOfLastName) { boolean lineOne = theLines.charOf(firstLetterOfLastName) > 'M'; if (lineOne) { return line; } else { return lineTwo; } } }
public class ConferenceRegistrationAssistant {
private char theLines;
public 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;
int line = 1;
public boolean goToLine(char firstLetterOfLastName) {
boolean lineOne = theLines.charOf(firstLetterOfLastName) > 'M';
if (lineOne) {
return line;
} else {
return lineTwo;
}
}
}
2 Answers
Jennifer Nordell
Treehouse TeacherI posted a fairly detailed explanation and solution here not long ago: https://teamtreehouse.com/community/-bummer-i-entered-zimmerman-and-expected-to-get-back-line-2-as-z-comes-after-m
Take a look! Hope this helps
Russell Brookman
3,118 PointsAh, thanks.. You're the best.
Blake Larson
13,014 PointsBlake Larson
13,014 PointsThank you for that post. I was wondering if you could quickly explain why there is only 1 variable (line) when we are making to different lines.
Jennifer Nordell
Treehouse TeacherJennifer Nordell
Treehouse TeacherBlake Larson yes there are two different lines. But you can think of the "line" variable as holding the number of the line. Line can either be line number one or line number 2. But at the end of the day, it's still a line, right? It's only the number that changes. In fact, we could have 10 lines and still it would only be the number of the line that's changing. We're simply setting up the variable line to hold the number of the line being assigned. Hope that helps!
Blake Larson
13,014 PointsBlake Larson
13,014 PointsYeah it's starting to make sense now. Thank you.