CIS 260 Intro to C++

Hints: Calendar Printing Project

 

How do I know if I'm breaking the problem down (functional decomposition) correctly?

Here is a list of questions to help you generate ideas for breaking down this problem. 

Are all of the weeks on the calendar the same? If not, how are they different?

Do they ALL start on Sunday, or do they start on different days of the week?

Do they ALL end on Saturday, or do they end on different days of the week?

Does every week have a different number of days, or are they all FULL weeks?

Can you break the calendar into normal weeks and special weeks? If so, are the normal and special weeks always in the same order?

What pieces of information do you need to know to print out a normal week? (Don't make this step too complicated, ALL you want to do is print out ONE normal week)

For each of your special weeks: What pieces of information do you need to know to print this special week? (Keep each special week as a separate case, all you want to do is print out that ONE special week)

Reality Check: How has the problem changed? 

What have we accomplished by asking (and answering) all of these questions?

Hopefully: Instead of having one large problem to solve (printing a monthly calendar) now we should have a couple small problems which are considerably easier (print a normal week, print a special week, etc.)

What Now?

Using the information developed above, create a functional specification for each of the tasks identified. 

For Example:

prn_full_week

Header: void prn_full_week( /* in */ int date4sunday )
PreCondition:  date4sunday is assigned && 
			1 <= Num2Print <= 92
PostCondition: Seven days (Sun - Sat) have been printed and numbered
               beginning with date4sunday
Don't forget about our good friend the ALGORITHM! 
CurrentDate = date4sunday
FOR day_of_week = Sun TO Sat
   Print Day
   CurrentDate++
ENDFOR
etc.

Remember that main() will also need an ALGORITHM, but the "steps" will mostly consist of calls to your other functions.

Good Luck!