Kate S.

asked • 11/14/14

How to I change a switch operation on a string to work in eclipse 1.6?

This is the code I have:
 
public static double monthly(String month) {
switch (month) {
case "01":
return .5;
case "07":
return .5;
default:
return 1;
}
}
 
However, eclipse does't allow switch of a string in the 1.6 version. I'm having difficulty figuring out how to make it into a regular if-else or really anything else that could work in the earlier versions of eclipse.

1 Expert Answer

By:

Evan H. answered • 11/14/14

Tutor for Math, Chem, Physics, and Computer Science!

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.