
Evan H. answered 11/14/14
Tutor
4.8
(10)
Software Engineer specializing in Software Architecture and SRE
Converting a switch into an if/else is simple. You simply get rid of the "switch(month)" and make each case an if/else if with the default being the final else:
This code would then become:
public static double monthly(String month) {
if (month == "01") {
return 0.5;
} else if (month == "07") {
return .5;
} else {
return 1;
}
}