public class Test{
public static void main(String[] args){
System.out.println(monthNameToDays("March",2012));
}
public static int monthNameToDays(String s, int year) {
switch(s) {
case "April": case "June":
case "September": case "November":
return 30;
case "January": case "March":
case "May": case "July":
case "August": case "December":
return 31;
case "February":
return 28;
default:
return 0;
}
}
}
No comments:
Post a Comment