Question: import java.util.Scanner; // Enables user input. public class Easter { public static void main(String[] args) { Scanner scnr = new Scanner(System.in); int year = 0;
import java.util.Scanner; // Enables user input.
public class Easter { public static void main(String[] args) { Scanner scnr = new Scanner(System.in); int year = 0; // FIXME: Declare variables System.out.println("Please enter a year: "); // FIXME: Obtain user input
// FIXME: Calculations /* If n equals 3, Easter month falls in March If n equals 4, Easter month falls in April Otherwise, there is a mistake. */ if (monthEaster == 3) { System.out.print("In year " + year + ", Easter falls on March " + dayEaster + "."); } else if (monthEaster == 4) { System.out.print("In year " + year + ", Easter falls on April " + dayEaster + "."); } else { System.out.println("This is a mistake! Please enter a 4-digit year."); } return; }
Prompt the user to enter a 4-digit year. Declare the variable and complete the expressions to find the Easter date in a given year. The program will display the Easter month and day for the year.
a is the year modulus 19
b is the year divided by 100
c is the year modulus 100
d is b divided by 4
e is b modulus 4
g is (8*b + 13) divided by 25
h is (19*a + b - d - g + 15) modulus 30
j is c divided by 4
k is c modulus 4
L is (a + 11*h) divided by 319
m is (2e + 2j - k - h + L + 32) modulus 7
monthEaster is (h - L + m + 90) divided by 25
dayEaster is (h - L + m + monthEaster + 19) modulus 32
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
