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]
3 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]3 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
A group of students is performing an investigation to measure how much liquid water is produced from a 10 L sample of snow. What
Afina-wow [57]

Answer:

the temperature of the sample must change

Explanation:

7 0
2 years ago
When assigning a value to a string, which of the following rules needs to be followed?
Alecsey [184]

Answer:

Let's say you need to remember some information, the way moviegoers tried to remember the name of the movie. Instead of storing it in your human memory, you can store information in your computer's memory using Python. This is called assigning a string value to a variable.

To assign a string value to a variable in Python, follow this example. Select each part of the code to see how it works with the movie title example.

movieTitle = "Live. Die. Repeat."

This line of Python code is an example of an assignment statement. In an assignment statement, you tell Python, "This variable is assigned this string value."

Explanation:

4 0
2 years ago
A complete traversal of an n node binary tree is a(n)____ "operation if visiting a node is O(1)for the iterative implementation
ch4aika [34]

Answer:

B.O(n).

Explanation:

Since the time complexity of visiting a node is O(1) in iterative implementation.So the time complexity of visiting every single node in binary tree is O(n).We can use level order traversal of a binary tree using a queue.Which can visit every node in O(n) time.Level order traversal do it in a single loop without doing any extra traversal.

8 0
3 years ago
Imagine a mythical set of protocols with the following details. Maximum Link-Layer data frame: 1,455 bytes Network-Layer header
NemiM [27]

Answer:

The MSS is 1455

Explanation:

MSS or maximum segment size is the total number of data transferred minus the TCP and IP header. The total number of transmitted frames in a switch network is between 64 bytes to 1518 bytes with a header and trailer. The MSS does not exclude this data-link layer effect but only the transport layer like TCP and UDP, and IP address header, unlike the mtu (maximum transfer unit) which involves all headers.

4 0
2 years ago
Assume the secret key is: (1, 2, 3, 4) -&gt; (3, 1, 4, 2); assume the plaintext THEYLOVEIT. If the sub-block length is 3, what i
Alex777 [14]
I belive their were answer chocies to this question am i right 

8 0
2 years ago
Other questions:
  • Mike is reading about machine-dependent programming languages. Which languages are machine-dependent programming languages?
    11·1 answer
  • Suppose we provide a new implementation of the transport layer protocol tcp providing the same functionality using different alg
    14·1 answer
  • You may be guilty of plagiarism even if
    13·1 answer
  • In computers, when the print command is executed, a cable carries this signal from the computer to the printer. In comparing a c
    11·1 answer
  • Translate the following C++ program to MIPS assembly program. *Please explain each instruction of your code by a comment and sub
    5·1 answer
  • A computer is unable to access the network. when you check the led lights near the computer's network port, you discover the lig
    6·1 answer
  • Identify the electronic community that is a social-networking site.
    5·2 answers
  • You received an email message stating that your mother's bank account is going to be forfeited if you do not respond to the emai
    6·1 answer
  • Write a recursive method called sumTo that accepts an integer parameter n and returns a real number representing the sum of the
    12·1 answer
  • explain the following joke: “There are 10 types of people in the world: those who understand binary and those who don’t.”
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!