Question:
Output example:
This assignment will test your ability to define your own Exception classes, use exception handling, define an Interface and implement interfaces. The basic idea of this assignment is to write your own Date class (since one exists in Java, call it something different like MyDate). The UML is given below month, day, year: int +MyDate ) +MyDate (fullDate: String) throws IllegalDateException +getMonth String -getMonthAsInt): int +getDay): int +getYear int +setMonth (month: int) throws IllegalDateException +setDay (day: int) trows IllegaDateException +setYear (year int) +tostring): String 1 The no-arg constructor should set the MyDate's date to the date of when you write the program. For instance, if the date is May 8, 2018 then the no-arg constructor will set the date to 5, 8, 2018. The 1-arg constructor receives a String in the form "01/02/2003". You will have to parse this String using substring to get the three parts of it month, day and year and then parse each item as an int to store the three in their instance data (e.g., store "01" as 1 in month and "2003" as 2003 in year). The MyDate will be stored as three int values, so "01/02/2003" would be stored as 1.2. 2003 The MyDate class will have accessors and mutators for all three values (month, day, year). The getMonth0 method will return the month as a String, so you have to convert from the int value (e.g, 5) to the name of the month (e.g, "May"). All three mutators (setMonth, setDay, set Year) will receive an int value (month, day, year respectively). Both setMonth and setDay can throw an IllegalDateException if the month or day is not correct (as can the constructor). The month is invalid ifit is not between 1 and 12 and the day is invalid if it is less than 1 or greater than the maximum date for that month. NOTE: do not worry about leap years, always assume February has 28 days. Assume year is always valid so that setYear will not throw an IllegalDateException. The toString method should return the String in the form "01/02/03" or "01/02/1998". If the month and day are single digits, prepend the digit with a '0. If the year is 2000, use the String "00", if the year is between 2001 and 2009, output the year as two digits as in "03" (prepend a 0) and if the year is after 2009, output it as two digits, however if the year is before 2000, then output the year in four digits, so you get "03" for 2003, "18 for 2018 and "1998" for 1998. The IllegalDateException will require two constructors, a no-arg constructor which will simply do super ("some useful message")such as "Bad date specified": and a 1-arg constructor which will pass on the message it receives. The lllegalDateException can be thrown from the MyDate constructor, setMonth and setDay methods only. In each case, throw a useful message such as "Bad Month: 13" or "Bad Day: there is no April 31