Created
November 12, 2013 06:35
-
-
Save pawelkw/7426483 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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