Question: 3. Implement the class Date that represents a date in day/month/year format as shown in the UML class diagram below with following details: Default constructor
3. Implement the class Date that represents a date in day/month/year format as shown in the UML class diagram below with following details: Default constructor should generate a randomdate (random year must be in range 1970-2018). The other constructor set the date accordingtothe given parameters(arguments). Both constructors should validate date entries with the help of the private function validateDate. validateDate checks for non-negative years, months range is 1-12 and day's range is 1-31 and also according to the table below otherwise it will set illegal values only to 1. . . display method should show the date like in the following example: 28-2-2018 . isEqual receives another date and return true if both dates are equal Month Month Name Number of Date day int (no leap years) month: int year: int +Date) Date(d: int, m: int, y. int) +getDay0: int +getMonth int + getyeanx int +isEqual(dat: Date): boolean String(): String Implement another class called Day which contains a Date object and a string attribute that represents the name of the day (eg Saturday, Sunday, ..etc). For example, today is Wednesday where the date is 28/2/2018. The constructor accepts and initializes the day name and its date object. Add the getter methods getDate and getDayName. Don't add any setters Run a main function that will create a two Date objects: one for today 28/2/2018 and the other is random date. Display full information of both days to the screen and state (using the available methods) if both dates are the same. Then, create one Day object representing today "Wednesday" with current date and display its full information (as read from the day object) to the screen as follows. Today is Wednesday and the date is 28-2-2018
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
