I do agree we shouldn't just give you the code and let you copy and paste it, however I'll help you as best as I can.
I assume if the user inputs an invalid number, the program will prompt the user to input the number again, whether it be from the month or day. The problem with Alan-LB's code, is that the program will not exit or prompt the user for a valid input, if the user doesn't do so. For instance, if the user inputs 13, Alan's coding will simply go through the program output messages saying an invalid input has been made, then output winter as the default.
You would want a while loop that checks whether or not months were valid and re-prompt the user for another input, if invalid. Same goes for days. There's no need for the else statements. The switch case that Alan mentioned would be adequate, although it should be Autumn in the default, not Winter.
|