Thank you comment out if possible Using the switch multiples
Thank you. comment out if possible
Using the switch multiple-selection statement control statements to return the number of days in a month. Each month will be represented by a corresponding integer (1 is January, 2 is February, ...12 is December). There should be separate cases for months with 30 days (September, April, June, and November), months with 31 days (January, March, May, July, August, October, December) and February is its own case. Please help write this java codeSolution
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be \"Main\" only if the class is public. */
class mouth
{
int days_cout;
static void date(int year,int mouth)
{
switch(mouth)
{
case 1:days_cout=31;
break;
case 2:if(((year%400==0)||(year%4==0))&&(year%100!=0))
{
days_cout=29;
brak;
}
else
{
days_cout=28;
break;
}
break;
case 3:days_cout=31;
break;
case 4:days_cout=30;
break;
case 5:days_cout=31;
break;
case 6:days_cout=30;
break;
case 7:days_cout=31;
break;
case 8:days_cout=31;
break;
case 9:days_cout=30;
break;
case 10:days_cout=31;
break;
case 11:days_cout=30;
break;
case 12:days_cout=31;
break;
}
return days_cout;
}
}
class Codechef
{
public static void main (String[] args) throws java.lang.Exception
{
int c;
month a1 =new month();
c=a1.date(2014,3);
System.out.println(\"days =\"+c);
c=a1.date(2004,4);
System.out.println(\"days =\"+c);
c=a1.date(1990,2);
System.out.println(\"days =\"+c);
}
}

