Writting an application

Write an application in which the user can enter a date using digits and slashes (for example, “2/4/2010”), and receive output that displays the date with the month shown as a word (such as “February 4, 2010”). Allow for the fact that the user might or might not precede a month or day number with a zero (for example, the user might type “02/04/2010” or “2/4/2010”). Do not allow the user to enter an invalid date, defined as one for which the month is less than 1 or more than 12, or one for which the day number is less than 1 or greater than the number of days in the specified month. Also display the date’s ordinal position in the year; for example, 2/4 is the 35th day. In this application, use your knowledge of arrays to store the month names, as well as values for the number of days in each month so that you can calculate the number of days that have passed. Figure 8-34 shows the output when the user has entered 2/4/2010.

You may also like