Make a program that asks for the last name of the
user. Depending on their last name, make a statement about
how long they have to wait during roll call. You need to use
else if
s to make sure only one statement
gets printed.
Once you understand how compareTo()
works, this is a
pretty straightforward assignment, much like
How Old Are You, specifically, except that it uses
String
s instead of
int
s and so you must use the
compareTo()
method.
"Carswell"
or before: say "you don't have to wait long"
"Jones"
or before: say "that's not bad"
"Smith"
or before: say "looks like a bit of a wait"
"Young"
or before: say "it's gonna be a while"
"Young"
: say "not going anywhere for a while?"
What's your last name? Stephanopolis It's going to be a while before we get to you, "Stephanopolis".
©2013 Graham Mitchell
This assignment is licensed under a
Creative Commons Attribution-NonCommercial-ShareAlike 3.0 United States License.