| about | help | code help+videos | done | prefs |
isSummer
public boolean isSummer(String month)
public boolean isSummer(String month) {
boolean summer = false;
if (month.equals("June")) {
summer = true;
}
if (month.equals("July")) {
summer = true;
}
if (month.equals("August")) {
summer = true;
}
return summer;
}
NOTE: that if you have 3 successive IF statements, they can be
collapsed into a single statement if you separate them with || (OR).
public boolean isSummer(String month) {
boolean summer = false;
if ( month.equals("June") || month.equals("July") || month.equals("August") ) {
summer = true;
}
return summer;
}
isSummer("January") → false isSummer("February") → false isSummer("March") → false ...Save, Compile, Run (ctrl-enter) |
Progress graphs:
Your progress graph for this problem
Random user progress graph for this problem
Random Epic Progress Graph
Difficulty: 1
Copyright Nick Parlante 2017 - privacy