Question

Write a complete program in C ++ to calculate the day Easter will fall on based...

Write a complete program in C ++ to calculate the day Easter will fall on based on these INTEGER equations by inputting the integer year and outputting the date of Easter.

Y = Year read in

N = Y - 1900

A = N - (N/19)*19

B = (7*A + 1)/19

C = 11*A + 4 - B

M = C - (C/29)*29

Q = N/4

S = N + Q + 31 - M

W = S - (S/7)*7

DATE = 25 - M - W

If DATE = 0 then Easter is March, 31

If DATE < 0 then Easter is March, (31 + DATE)

If DATE > 0 then Easter is April, DATE

Homework Answers

Answer #1
#include <iostream>

using namespace std;

int main() {
    int year;
    cout << "Enter year: ";
    cin >> year;

    int N = year - 1900;
    int A = N - (N/19)*19;
    int B = (7*A + 1)/19;
    int C = 11*A + 4 - B;
    int M = C - (C/29)*29;
    int Q = N/4;
    int S = N + Q + 31 - M;
    int W = S - (S/7)*7;
    int DATE = 25 - M - W;

    if (DATE == 0) {
        cout << "easter is on March, 31" << endl;
    } else if (DATE < 0) {
        cout << "easter is on March, " << 31+DATE << endl;
    } else {
        cout << "easter is on April, " << DATE << endl;
    }
    return 0;
}
Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Write a program in python that computes the date of Easter Sunday for a specified year....
Write a program in python that computes the date of Easter Sunday for a specified year. 1.Ask the user for the year (such as 2001). Save the year in y. 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...
Write a C++ program to demonstrate thread synchronization. Your main function should first create a file...
Write a C++ program to demonstrate thread synchronization. Your main function should first create a file called synch.txt. Then it will create two separate threads, Thread-A and Thread-B. Both threads will open synch.txt and write to it. Thread-A will write the numbers 1 - 26 twenty times in nested for loops then exit. In other words, print 1 - 26 over and over again on separate lines for at least 20 times. Thread-B will write the letters A - Z...
C program fractions.c that does the following: 1. The program starts by making the user enter...
C program fractions.c that does the following: 1. The program starts by making the user enter a non-negative integer number a, called the first numerator. If the user enters a negative number, the program repeats the entry. 2. The program then makes the user enter a positive integer number b, called the first denominator. If the user enters a non-positive number, the program repeats the entry. 3. The program then makes the user enter a non-negative integer number c, called...
Given that A to Z are mapped to integers 0-25 as follows. A:0, B:1, C:2, D:3,...
Given that A to Z are mapped to integers 0-25 as follows. A:0, B:1, C:2, D:3, E:4, F:5, G:6, H:7, I: 8, J: 9, K:10, L:11, M:12, N:13, O:14, P:15, Q:16, R:17, S:18, T:19, U:20, V:21, W:22, X:23, Y:24, Z:25. Encrypt the following message using Vigenere Cipher with key: CIPHER THISQUIZISEASY What is the ciphertext? Show your work. PLEASE HELP
USE ONLY C LANGUAGE The program should read inputs that look like this: 10 11 56...
USE ONLY C LANGUAGE The program should read inputs that look like this: 10 11 56 92 10 5 42 7 1 33 99 The program should start by reading one integer, which indicates how many numbers there are in the random sequence. The program should then read a sequence of random integers. If fewer numbers are provided than specified (by the first integer on the first line), the program should print the following error message (replace XXX with the...
Write a program of wordSearch puzzle that use the following text file as an input. The...
Write a program of wordSearch puzzle that use the following text file as an input. The output should be like this: PIXEL found (left) at (0,9). ( Use JAVA Array ) .Please do not use arrylist and the likes! Hints • The puzzle can be represented as a right-sized two-dimensional array of characters (char). • A String can be converted into a right-sized array of characters via the String method toCharArray. . A word can occur in any of 8...
Ciphertext WHKCJILXI was encrypted by affine cipher C = A*P + 8 (mod 26), where parameter...
Ciphertext WHKCJILXI was encrypted by affine cipher C = A*P + 8 (mod 26), where parameter A is uknown. You have a following additional information: plaintext letter L was encrypted by letter H. Find A and decrypt the message. You can use applet for decryption. For your convenience, below are numeric values of ENGLISH letters: A=0 B=1 C=2 D=3 E=4 F=5 G=6 H=7 I=8 J=9 K=10 L=11 M=12 N=13 O=14 P=15 Q=16 R=17 S=18 T=19 U=20 V=21 W=22 X=23 Y=24...
USE PYTHON ONLY PLEASE Zeller’s congruence is an algorithm developed by Christian Zeller to calculate the...
USE PYTHON ONLY PLEASE Zeller’s congruence is an algorithm developed by Christian Zeller to calculate the day of the week. The formula is h = (q + 26(m+1)//10 + k + k//4 +j//4 +5j) % 7 where - h is the day of the week (0: Saturday, 1: Sunday, 2: Monday, 3: Tuesday, 4: Wednesday, 5: Thursday, 6: Friday). - q is the day of the month. - m is the month (3: March, 4: April, ..., 12: December). January...
Question 2: Write a C program that read 100 integers from the attached file (integers.txt) into...
Question 2: Write a C program that read 100 integers from the attached file (integers.txt) into an array and copy the integers from the array into a Binary Search Tree (BST). The program prints out the following: The number of comparisons made to search for a given integer in the BST And The number of comparisons made to search for the same integer in the array Question 3 Run the program developed in Question 2 ten times. The given values...
public static void main(String[] args) {        // TODO Auto-generated method stub        Scanner...
public static void main(String[] args) {        // TODO Auto-generated method stub        Scanner keyboard = new Scanner(System.in);        System.out.println("Enter a date in the format month/day/year");        String date = keyboard.nextLine();        //Make a copy        String dateCopy = date;               //Extract the values        //start with month        //indexOf() is used to find the index of a specified character in a givenString        int workingIndex = date.indexOf("/");...