Skip to content

Instantly share code, notes, and snippets.

@pawelkw
Created November 12, 2013 06:35
Show Gist options
  • Save pawelkw/7426483 to your computer and use it in GitHub Desktop.
Save pawelkw/7426483 to your computer and use it in GitHub Desktop.
public String getTypeOfDayWithSwitchStatement(String dayOfWeekArg) {
String typeOfDay;
switch (dayOfWeekArg) {
case "Monday":
typeOfDay = "Start of work week";
break;
case "Tuesday":
case "Wednesday":
case "Thursday":
typeOfDay = "Midweek";
break;
case "Friday":
typeOfDay = "End of work week";
break;
case "Saturday":
case "Sunday":
typeOfDay = "Weekend";
break;
default:
throw new IllegalArgumentException("Invalid day of the week: " + dayOfWeekArg);
}
return typeOfDay;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment