Question: Write a program that converts dates from numerical month-day format to alphabetic month-day format. For example, input of 1/31 or 01/31 would produce January 31
Write a program that converts dates from numerical month-day format to alphabetic month-day format. For example, input of 1/31 or 01/31 would produce January 31 as output. The dialogue with the user should be similar to that shown in Programming Project 2. You should define two exception classes, one called MonthException and another called DayException. If the user enters anything other than a legal month number (integers from 1 to 12), your program should throw and catch a MonthException. Similarly, if the user enters anything other than a valid day number (integers from 1 to either 29, 30, or 31, depending on the month), your program should throw and catch a DayException. To keep things simple, assume that February always has 28 days.
Step by Step Solution
3.43 Rating (166 Votes )
There are 3 Steps involved in it
public class MonthException extends Exception public MonthException superInvalid input for month public MonthExceptionint monthNumber supermonthNumber is invalid month number must be from 1 to 12 publ... View full answer
Get step-by-step solutions from verified subject matter experts
