[Java]
/*
* Start the program header annotation.
* Copyright and version Declaration of the program
* Copyright (c) 2011, a student from the computer College of Yantai University
* All rights reserved.
* File name: a tool that calculates the number of days in a month and determines whether it is a leap year.
* Author: Xue Guangchen
* Completion date: January 1, September 15, 2011
* Version No.: x1.0
* Description of tasks and Solutions
* Input description:
* Problem description:
* Program output:
* End the comment in the program Header
*/
Package xue.com;
Public class Calculate_Day {
Public static boolean judge (int year)
{
Boolean yearleap = (year % 400 = 0) | (year % 4 = 0) & (year % 100! = 0); // use boolean data computing to determine whether division can be performed
Return yearleap;
}
Public static int calculate (int year, int month)
{
Boolean yearleap = judge (year );
Int day;
If (yearleap & month = 2)
{
Day = 29;
}
Else if (! Yearleap & month = 2)
{
Day = 28;
}
Else if (month = 4 | month = 6 | month = 9 | month = 11)
{
Day = 30;
}
Else
{
Day = 31;
}
Return day;
}
}