1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Nadya [2.5K]
4 years ago
15

Easter Sunday is the first Sunday after the first full moon of spring. To compute the date, you can use this algorithm, invented

by the mathematician Carl Friedrich Gauss in 1800:
1. Let y be the year (such as 1800 or 2001).
2. Divide y by 19 and call the remainder a. Ignore the quotient.
3. Divide y by 100 to get a quotient b and a remainder c.
4. Divide b by 4 to get a quotient d and a remainder e.
5. Divide 8 * b 13 by 25 to get a quotient g. Ignore the remainder.
6. Divide 19 * a b - d - g 15 by 30 to get a remainder h. Ignore the quotient.
7. Divide c by 4 to get a quotient j and a remainder k.
8. Divide a 11 * h by 319 to get a quotient m. Ignore the remainder.
9. Divide 2 * e 2 * j - k - h m 32 by 7 to get a remainder r. Ignore the quotient.
10. Divide h - m r 90 by 25 to get a quotient n. Ignore the remainder.
11. Divide h - m r n 19 by 32 to get a remainder p. Ignore the quotient.
Then Easter falls on day p of month n. For example, if y is 2001:
a = 6 h = 18 n = 4
b = 20, c = 1 j = 0, k = 1 p = 15
d = 5, e = 0 m = 0
g = 6 r = 6
Therefore, in 2001, Easter Sunday fell on April 15. Write a program that prompts the user for a year and prints out the month and day of Easter Sunday.
Part 1: Problem-Solving Phase
Using the Design Recipe, write each of the following for this problem:
Contract
Purpose Statement
Examples, making sure to include counter-examples
Algorithm (based on the above algorithm, completed with input/output steps)
Make sure to test your algorithm by hand with the examples to verify it before continuing to Part 2.
Part 2: Implementation Phase
Using Eclipse, write the Java program for the algorithm formulated in Part 1, and test your program with the examples from Part 1.
Make sure to incorporate your Contract, Purpose Statement and Examples as one or more comment blocks, and your Algorithm as line comments in your Java source code.
Computers and Technology
1 answer:
BlackZzzverrR [31]4 years ago
7 0

Answer:

The program written in Java without comment is as follows

import java.util.*;

public class MyClass {

   public static void main(String args[]) {

       Scanner input = new Scanner(System.in);

       System.out.print("Year: ");

       int y = input.nextInt();

       int a = y%19;

       System.out.println("a = "+a);

       int b = y / 100;

       System.out.println("b = "+b);

       int c = y%100;

       System.out.println("c = "+c);

       int d = b / 4;

       System.out.println("d = "+d);

       int e = b%4;

       System.out.println("e = "+e);

       int g = (8 * b + 13)/25;

       System.out.println("g = "+g);

       int h = (19 * a + b - d - g + 15)%30;

       System.out.println("h = "+h);

       int j = c/4;

       System.out.println("j = "+j);

       int k = c%4;

       System.out.println("k = "+k);

       int m = (a + 11 * h)/319;

       System.out.println("m = "+m);

       int r = (2 * e + 2 * j - k - h + m + 32)%7;

       System.out.println("r = "+r);

       int n = (h - m + r + 90)/25;

       System.out.println("n = "+n);

       int p = (h - m + r + n + 19)%32;

       System.out.println("p = "+p);

   }

}

Explanation:

<em>I've added the full source code as an attachment where I use comments to explain difficult lines</em>

Download java
You might be interested in
Which technologies are currently used in health ​
GaryK [48]
1. Portable Monitors. ...
2. Smart Beds. ...
3. Wearable Devices. ...
4. Electronic Health Records. ...
5. Centralized Command Centers. ...
6. Telehealth and Apps.
7 0
2 years ago
Is a system software that manages the hardware resources and provides services 5o the application software
Alborosie

Answer:

"Operating system" is the right response.

Explanation:

  • The key program collection on something like a computer device that maintains it interacts mostly with underlying hardware of that system is considered as an Operating system.
  • Even without the need for an OS, every consumer isn't able to access either equipment, monitor as well as portable phone or devices.
8 0
3 years ago
Never mind I got it
sergiy2304 [10]
<span>She is estimating the future profits with an estimate of long-term sales and the actual cost incurred.</span>
5 0
3 years ago
Read 2 more answers
Write a function:
Elden [556K]

Answer:

what are the choices

:"

Explanation:

5 0
3 years ago
Which of the following statements about personality tests are true? Check all of the boxes that apply.
borishaifa [10]

Answer:

They evaluate a person’s personality traits And They can be used as self-assessment tools for career planning. are the answers.

4 0
4 years ago
Other questions:
  • Clunker Motors Inc. is recalling all vehicles from model years 1995-1998 and 2004-2006.Given a variable modelYear write a statem
    5·1 answer
  • If you use the ___ template, as opposed to a formatted theme, you must make all design decisions?
    15·1 answer
  • EDI decreases ______
    15·1 answer
  • Which type of computing refers to firms purchasing computing power from remote providers and paying only for the computing power
    7·1 answer
  • Which Fairy Tail character is this?
    14·2 answers
  • You need to transmit PII via email and you want to maintain its confidentiality. Which of the following choices is the BEST solu
    8·1 answer
  • When using a presentation software you can change the size of the text to...? Increase Font size, Decrease font size, increase t
    15·2 answers
  • Do you think that using robots at home would be good and helpful?
    11·1 answer
  • Which of the following events happened first
    15·2 answers
  • Why does rating an incorrect answer as 1 star raise its score on brainly?
    8·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!