eastersunday.java

来自「A specific version of a quicksorter whic」· Java 代码 · 共 40 行

JAVA
40
字号

//
// This is the EasterSunday class that will
// calculate the date on which Easter occurs in the given year.

public class EasterSunday
{
	private int year, month, day;

	public EasterSunday(int y)
	{
		year = y;
		int a, b, c, d, e, g, h, j, k, m, r, n, p;
		a = year % 19;
		b = year / 100;
		c = year % 100;
		d = b / 4;
		e = b % 4;
		g = (8 * b +13) / 25;
		h = (19 * a + b - d - g + 15) % 30;
		j = c / 4;
		k = c % 4;
		m = (a +11 *h) / 319;
		r = (2 * e + 2 * j - k - h + m + 32) % 7;
		n = (h - m + r + 90) / 25;
		p = (h - m + r + n + 19) % 32;
		month = n;
		day = p;
	}

	public int getMonth()
	{
		return month;
	}

	public int getDay()
	{
		return day;
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?