February 19, 2010

Preview



/**
* This program will determine the Easter Sundays in a given year from 1900-2099.
*
* Programmer Oliver December 2,2009
*/
import java.util.*;
public class Eastern
{
static Scanner console=new Scanner(System.in);
public static void main ()
{
int year;
int a,b,c,d,e;
int date;
String MonthName;
System.out.println("Enter year");
year=console.nextInt();
a=year%19;
b=year%4;
c=year%7;
d=(19*a+24)%30;
e=(2*b+4*c+6*d+5)%7;
date=22+d+e;
if (date>31)
{
MonthName="April";
date=d+e-9;
if ((d+e+22)==57)
date=date-7;
}
else if (date==31)
{
MonthName="April";
}
else
MonthName="March";
System.out.printf("Easter Sunday is %s %2d,%3d\n",MonthName,date,year);
}
}

No comments:

Post a Comment