Answered step by step
Verified Expert Solution
Question
1 Approved Answer
objectives This assignment requires you to write a program in Java that calculates the day of week and the week of month for a given
objectives This assignment requires you to write a program in Java that calculates the day of week and the week of month for a given date, as well as to print the calendar of the month where the given date exists Background 2017 MAY UNIVERSITY OF For a given date, we can use the Gregorian calendar to find the comesponding the day of the week, and the week of the month. For example, May 272017 is a Saturday and locates in the fourth week 2017. In general, we can use the following formula (Zeller's congruence to calculate the day of a week for any given date after October 15 1582. K+ where his the day of the week (0- Saturday, 1 Sunday, 2-Monday, 3 Tuesday, 4 Wednesday, 5 Thursday, 6-Friday g is the day of the month m is the month (3-March, 4-April, 5-May, 6 June, 7 July, 8 August, 9 September, 10 October, 11 November, 12 December, 13 January, 14- February) Kis the year of the century lyear mod 100). year 1000. For example, the zero-based centuries for 1995 and 2000 are 19 and 20 respectively. For example, For 1 January 2000, the date would be treated as the 13th month of 1999, so the values would be: q-1, m-13, K-99, J-19, so the formula is (1+[182/5]+99+199/4] [19/4]+95) mod 7 (1+136.4]+99+124.75] (4.75) 95) mod 7 -(1+36+99+24+4+95) mod 7 Saturday However, for 1 March 2000, the date is treated as the 3rd month of 2000, so the values become q 1, m 3, K-00, J-20, so the formula is
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started