about | help | code help+videos | done | prefs |
public boolean isSummer(String month) VERSION 2
public boolean isSummer(String month) { boolean summer = false; if (month.equalsIgnoreCase("june")) { summer = true; } if (month.equalsIgnoreCase("JULY")) { summer = true; } if (month.equalsIgnoreCase("august")) { summer = true; } return summer; }Note that another way to code this, if you want to use equals() is to use toLowerCase() public boolean isSummer(String month) { boolean summer = false; month = month.toLowerCase(); if (month.equals("june")) { summer = true; } if (month.equals("july")) { summer = true; } if (month.equals("august")) { summer = true; } return summer; } isSummer("JUNE") → true isSummer("august") → true 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