programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
• Campbell Ritchie
• Jeanne Boyarsky
• Ron McLeod
• Paul Clapham
• Liutauras Vilda
Sheriffs:
• paul wheaton
• Rob Spoor
• Devaka Cooray
Saloon Keepers:
• Stephan van Hulst
• Tim Holloway
• Carey Brown
• Frits Walraven
• Tim Moores
Bartenders:
• Mikalai Zaikin

# How to display a yearly calendar using arrays a loops?

Greenhorn
Posts: 2
• Number of slices to send:
Optional 'thank-you' note:
Ok, so my teacher gave us a calendar assignment, where we have to display each month of a year dependent on what year it is. The first day of the year is calculated (0-6 meaning Sunday-Saturday), and the user inputs the year. He has stored how many days are in each month in an array called daysPerMonth. I am so confused on how to go about this because he wants us to access the array and display that many days and display each next month. Doing this, while also accounting for the first day of the year. Can anyone help? The teacher has provided much of the code and has gives us 2 functions to fill in. Please help? I am so confused help please? Where it asks for me to implement code that is my attempt at writing some code

Saloon Keeper
Posts: 10719
86
• Number of slices to send:
Optional 'thank-you' note:
Your method firstDayOfNextMonth(int numDays, int firstDay) takes two arguments, the number of days in this month, and the day this month starts on. I suggest taking your calendar off the wall and playing computer and see if you can see a pattern emerge when you count off the number of days starting from the firstDay of this month. Your result needs to be >= 0 and <= 6 to indicate Sunday through Saturday of the next month.

Rancher
Posts: 5008
38
• Number of slices to send:
Optional 'thank-you' note:

Marshal
Posts: 4509
572
• Number of slices to send:
Optional 'thank-you' note:

Augusto - we have no problem with you posting the same question on multiple sites, but please Be Forthright When Cross Posting To Other Sites so that nobody spends their time trying to help with a problem which has already been answered elsewhere.

Bartender
Posts: 1845
10
• Number of slices to send:
Optional 'thank-you' note:
First step I would suggest: