public class RuiNian
{
public static void main (String [] args)
{
int month=2,day=15;
int sumDays = 0;
int[] daysData = new int [] { 31,29,31,30,31,30,31,31,30,31,30,31};
switch( month )
{
case 1:
sumDays += day; break;
case 2:
sumDays= daysData[0] + day;
break;
case 3:
sumDays= daysData[0] + daysData[1] +day;
break;
case 4:
sumDays= daysData[0] + daysData[1] +daysData[2] +day;
break;
case 5:
sumDays= daysData[0] + daysData[1] +daysData[2] +daysData[3] +day;
break;
case 6:
sumDays= daysData[0] + daysData[1] +daysData[2] +daysData[3] +daysData[4] +day;
break;
case 7:
sumDays= daysData[0] + daysData[1] +daysData[2] +daysData[3] +daysData[4] +daysData[5] +day;
break;
case 8:
sumDays= daysData[0] + daysData[1] +daysData[2] +daysData[3] +daysData[4] +daysData[5] +daysData[6] +day;
break;
case 9:
sumDays= daysData[0] + daysData[1] +daysData[2] +daysData[3] +daysData[4] +daysData[5] +daysData[6] +daysData[7]+day;
break;
case 10:
sumDays= daysData[0] + daysData[1] +daysData[2] +daysData[3] +daysData[4] +daysData[5] +daysData[6] +daysData[7]+daysData[8]+day;
break;
case 11:
sumDays= daysData[0] + daysData[1] +daysData[2] +daysData[3] +daysData[4] +daysData[5] +daysData[6] +daysData[7]+daysData[8]+daysData[9]+day;
break;
case 12:
sumDays= daysData[0] + daysData[1] +daysData[2] +daysData[3] +daysData[4] +daysData[5] +daysData[6] +daysData[7]+daysData[8]+daysData[9]+daysData[10]+day;
break;
}
System.out.println("data" + sumDays);
}
}