Write a program that allows the user to enter a number representing the day of t
ID: 3538551 • Letter: W
Question
Write a program that allows the user to enter a number representing the day of the week that Jan. 1 fell on for a particular year. Use the scheme 0= Sunday, 1=Monday, and so on, up to 6=Saturday. Include error checking to ensure a valid day is entered. Your program should then display a tabular calendar for February of that year. You can assume that the year is NOT a leap year (i.e., you%u2019ll always have 28 days in February). Use at least one for loop in your solution.
Example 1: In 2011, Jan 1 fell on a Saturday. Sample program run:
Enter the day of the week that Jan. 1 fell on (0=Sun., 1=Mon., etc.)
6
February
_______
S M T W R F S
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
Example 2: In 2003, Jan 1 fell on a Wednesday. Sample program run:
Enter the day of the week that Jan. 1 fell on (0=Sun., 1=Mon., etc.)
3
February
_______
S M T W R F S
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
Hints:
Use System.out.print ( without the %u201Cln%u201D at the end ) to display something without automatically going to the next line.
Explanation / Answer
http://ideone.com/BVXVsH
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.