[Tutor] if-else statements
dyoo at hkn.eecs.berkeley.edu
Fri Oct 14 20:33:18 CEST 2005
> > For some reason, the months that have 31 days work fine, but the
> > months that have 28/30 do not work.
> How do you know that?
> Show us why you think there's a problem in the program. We have our own
> opinions, of course, but it'll be very helpful if you try explaining how
> you're thinking this through. Why do you think that the program is
As one more hint: try simplifying your problem. Can you change the
program to handle just January, and see if it can handle January dates
Next, can you modify your working program to handle both January and
February? Does it work on January and February dates correctly?
Next, can you modify your program to handle January, February, and March?
Once you figure that out, then it should be a little easier to scale the
program to all the months, and you should be able to better build on a
program that you can progressively test.
What we're trying to show you are general techniques for solving hard
More information about the Tutor