Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

// Question is: Write a program to compute the date of Easter Sunday. Easter Sunday is the first Sunday after the first full moon of

// Question is: Write a program to compute the date of Easter Sunday. Easter Sunday is the first Sunday after the first full moon of Spring. Use the following method, invented by the mathematician Carl Friedrich Gauss in 1800: .... (you can see how it works in my code)

Therefore, in 2001, Easter Sunday fell on 4/15. Write a complete program that allows the user to input a year from the keyboard, and have the program output the month and day values. Your solution must involve the creation of a method named gauss that accepts an integer parameter representing the year of interest.

My program works so far, but I don't know how to do that with the year in a separate method...

This is what I have so far:

import java.util.Scanner;

public class Easter { public static void main(String[] args) {

Scanner s = new Scanner (System.in); System.out.print ("For what year do you want to know when Easter is?"); int y = s.nextInt();

// info given by pset: int a = y % 19; int b = y / 100; int c = y % 100; int d = b / 4; int e = b % 4; int g = (8 * b + 13) / 25; int h = (19 * a + b - d - g + 15) % 30; int j = c / 4; int k = c % 4; int m = (a + 11 * h) / 319; int r = (2 * e + 2 * j - k - h + m + 32) % 7; int n = (h - m + r + 90) / 25; int p = (h - m + r + n + 19) % 32;

System.out.println("In the year " + y + " Easter is/was on day " + p + " of month " + n); } }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Online Market Research Cost Effective Searching Of The Internet And Online Databases

Authors: John F. Lescher

1st Edition

0201489295, 978-0201489293

More Books

Students also viewed these Databases questions