Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a program Calendar.java that takes two command line arguments m and y and prints out the monthly calendar for the mth month of year

Write a program Calendar.java that takes two command line arguments m and y and prints out the monthly calendar for the mth month of year y. You should only use conditionals and loops (NO ARRAYS OR SCANNERS FOR THIS PLEASE).

For example, your output for Calendar 2 2009 should be:

--------------------- February 2009 --------------------- Su Mo Tu We Th Fr Sa 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 --------------------- 

Formatting is VERY important as a computer is grading this so it's either 10% or 100.

This is what i do know..

Leap year: During leap years, an extra day is added to the 28 days of February. A year is a leap year if it is either divisible by 400 or divisible by 4 but not 100. e.g: 2000 and 2004 are leap years, but 1900 is not.

Day of Week: Given a month m, a day d, and a year y, the corresponding day of the week is computed as follows:

y0 = y - (14 - m) / 12 x = y0 + y0/4 - y0/100 + y0/400 m0 = m + 12 * ((14 - m) / 12) - 2 d0 = (d + x + (31*m0)/12) mod 7 // 0 for Sunday, ..., 6 for Saturday 

Use this formula to compute please.

Remember, NO ARRAYS OR SCANNERS please. This is the third time ive had to submit this question : /

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Multidimensional Array Data Management In Databases

Authors: Florin Rusu

1st Edition

1638281483, 978-1638281481

More Books

Students also viewed these Databases questions