Question: Java (4 pts) Problem 1 In 2020, New Year's Day (Jan. 1) was on Wednesday. We can use the mod operation to determine what day

 Java (4 pts) Problem 1 In 2020, New Year's Day (Jan.
Java

(4 pts) Problem 1 In 2020, New Year's Day (Jan. 1) was on Wednesday. We can use the mod operation to determine what day of the week Feb. 1 will be on. Let 0 represent Sunday, 1 represent Monday, 2 represent Tuesday, and so on. Jan. 1 was on Wednesday (3), and there are 31 days in January, so we start by computing 3 + 31 = 34. Since there are only 7 days in a week, we compute 34 mod 7 = 6, which corresponds to Saturday. Look at a calendar, and you'll see that Feb. 1 will indeed land on Saturday this year! Within your Lab1Hw folder, write a program named CalendarDates.java that asks the user to enter the day of the week of Jan. 1. Your program should then compute and show the day of the week of Apr. 15 (the deadline for filing federal taxes) and Oct. 31 (Halloween) of that year. Hint: Start by having your program compute how many days have elapsed from New Year's Day to each of the target dates. Then use the mod operation as above. You may assume: 1. The user will enter the day of the week as an integer from 0-6 (0 = Sunday, 1 = Monday, and so on). The results that your program gives are also integers. 2. The year is not a leap year - i.e., there are only 28 days in February. Here's an example of what your completed program might look like when you run it. Underlined parts indicate what you type in as the program is running. What day of the week was Jan. 17 Enter 0 for Sunday, 1 for Monday, and so on. The day of the week of Apr. 15 is: 2 The day of the week of Oct. 31 is: 5 (Note that the results in this example aren't accurate for 2020 because 2020 is a leap year. The dates given by the program are off by one since its calculations assume no leap year. Aren't calendars fun?)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!