For today's homework, solve problem 1 (P4.2) Easter Sunday here: https://www.lol-101.com/classrooms/introduction-to-java/2-8-project-analyzing-before-coding. There is no need to make a video or presentation that the link mentions, and you only have to code the solution to the problem. We've already started doing this problem in class, and the code segment is here:
class Main { public static void main(String[] args) { int y = 2001; int a = y % 19; int b = y / 100; int c = y % 100; int d = b / 4; int e = b % 4; int g = (8 * b + 13) / 25; int h = (19 * a + b - d - g + 15) % 30; } }
Using this starter code as a template and a starting point, finish the rest of the problem and comment your answer here. Make sure also to add a Scanner to read in the year (stored in the variable y).
import java.util.Scanner; class Main { public static void main(String[] args) { Scanner x = new Scanner(System.in); int y = x.nextInt(); int a = y % 19; int b = y / 100; int c = y % 100; int d = b / 4; int e = b % 4; int g = (8 * b + 13) / 25; int h = (19 * a + b - d - g + 15) % 30; System.out.println(y); System.out.println(a); System.out.println(b); System.out.println(c); System.out.println(d); System.out.println(e); System.out.println(g); System.out.println(h); } }
class Main {
public static void main(String[] args) {
int y = 2001;
int a = y % 19;
int b = y / 100;
int c = y % 100;
int d = b / 4;
int e = b % 4;
int g = (8 * b + 13) / 25;
int h = (19 * a + b - d - g + 15) % 30;
int j = c / 4;
int k = c % 4;
int m = a + 11 * h;
int r = (2 * e + 2 * j - k - h + m) / 2;
int n = h - m + r + 90;
int p = h - m + r + n + 19;
System.out.println(y);
System.out.println(a);
System.out.println(b);
System.out.println(c);
System.out.println(d);
System.out.println(e);
System.out.println(g);
System.out.println(h);
System.out.println(j);
System.out.println(k);
System.out.println(h);
System.out.println(r);
System.out.println(n);
System.out.println(p);
}
}
import java.util.Scanner; class Main { public static void main(String[] args) { Scanner x = new Scanner(System.in); int y = x.nextInt(); int a = y%19; int b = y/100; int c = y%100; int d = b/4; int e = b%4; int g = (8*b+13)/25; int h = (19*a+b-d-g+15)%30; int j = c/4; int k = c%4; int m = (a+11*h)/319; int r = (2*e+2*j-k-h-m+32)%7; int n = (h-m+r+90)/25; int p = (h-m+r+n+19)%32; System.out.println(a); System.out.println(b); System.out.println(c); System.out.println(d); System.out.println(e); System.out.println(g); System.out.println(h); System.out.println(j); System.out.println(k); System.out.println(m); System.out.println(r); System.out.println(n); System.out.println(p); } }