# Computer Practical Question In Isc Examination Solved In Bluej Java

Find out the valid date. This question came in class 12(ISC) examination -2011. See the solve program.

import java.util.*;
class days
{
public void abc()
{int p=0;
Scanner a=new Scanner(System.in);
System.out.println("Input:");
System.out.print("Month number ");
int MM=a.nextInt();
System.out.print("Day ");
int DD=a.nextInt();
System.out.print("Year ");
int YYYY=a.nextInt();
System.out.print("Output:");
System.out.print("Corresponding day of the year is : ");
if(YYYY%4==0)
{
p=29;
}
else
{
p=28;
}
switch(MM)
{
case 1:
{
System.out.println(DD);
}
break;
case 2:
{int sum=31+DD;
System.out.println(sum);
}
break;
case 3:
{
int sum=31+p+DD;
System.out.println(sum);
}
break;
case 4:
{
int sum=31+p+31+DD;
System.out.println(sum);
}
break;
case 5:
{
int sum=31+p+31+30+DD;
System.out.println(sum);
}
break;
case 6:
{
int sum=31+p+31+30+31+DD;
System.out.println(sum);
}
break;
case 7:
{
int sum=31+p+31+30+31+30+DD;
System.out.println(sum);
}
break;
case 8:
{
int sum=31+p+31+30+31+30+31+DD;
System.out.println(sum);
}
break;
case 9:
{
int sum=31+p+31+30+31+30+31+31+DD;
System.out.println(sum);
}
break;
case 10:
{
int sum=31+p+31+30+31+30+31+31+30+DD;
System.out.println(sum);
}
break;
case 11:
{
int sum=31+p+31+30+31+30+31+31+30+31+DD;
System.out.println(sum);
}
break;
case 12:
{
int sum=31+p+31+30+31+30+31+31+30+31+30+DD;
System.out.println(sum);
}
break;
default:
System.out.println("Invalid");
}
}
}