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
What field would you use to store a value from another table?
Levart [38]

Answer:

A. Lookup

Explanation:

You would use the Lookup field to store a value from another table.

7 0
3 years ago
(tco 6) after connecting to an ftp site, the _____ command will upload multiple files.
m_a_m_a [10]
<span>After connecting to an ftp site, the mget command will upload multiple files.
</span><span>The </span>mget command<span>  retrieves multiple files from a remote server directory and stores them in the current local directory.
</span><span>ftp> mget <start of the like files> *
</span>

ftp> mget file01 file02 file03

ftp> mget filename*

ftp> mget *.txt

5 0
3 years ago
Which of the following could have a negative impact a planned route?
Nata [24]

Answer:

B

Explanation:

8 0
3 years ago
You can use a(n) ____ to visually separate related controls from other controls on the form.
maksim [4K]

Answer:

The correct answer to the following question will be Group Box.

Explanation:

Group Box:

  • A type container that contains many types of controls that are usually related to each other in the form.
  • It usually provides the identified grouping for other controls.
  • used for the subdivision of the forms.
  • Separation of the controls can be done with the help of grouping by group box.

5 0
3 years ago
Assume that the array arr has been declared . Write a statement that assigns the next to last element of the array to the variab
iris [78.8K]

Answer:

x=arr[arr.length-2]; is the correct answer for the given question.  

Explanation:

In the above statement firstly we calculate the length of the given array.The arr.length function is used to calculate the array length.As mention in the question we have to assign the next to last element of the array to the variable x, so we used arr[arr.length-2] and finally, we assign them to the variable x.

so the final statement is x=arr[arr.length-2];

6 0
3 years ago
Other questions:
  • In an ipv4 address, what are the maximum number of bits that can be used to identify the network address
    14·1 answer
  • What are two examples of management information systems?
    12·1 answer
  • What is output? Select all that apply.
    15·1 answer
  • What does the clone tile command do?
    15·2 answers
  • Assume that a signal is encoded using 12 bits. Assume that many of the encodings turn out to be either 000000000000, 00000000000
    9·1 answer
  • Part 1: For this assignment, call it assign0 Implement the following library and driver program under assign0: Your library will
    5·1 answer
  • a bus is full of passengers. if you count them by either twos, threes, or fives, there is one left. if you count them by seven t
    10·1 answer
  • It converts Assembly Language into machine language?​
    15·1 answer
  • Helppppppppppppppppppppppppppppppppp
    13·2 answers
  • allows users to enter text and control the computer with their voice.allows users to enter text and control the computer with th
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!