Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Please follow all instruction as they are very important. Thanks Develop in C++

ID: 3603741 • Letter: P

Question

Please follow all instruction as they are very important. Thanks

Develop in C++ a class date to represent a calendar. The class should provide the following operations . A default constructor that initializes a date object to 01-01-1900 . A class constructor that initializes a date object to a correct value using three integer . The function toString) that returns the string version of a date object. For example, . The function nextDate() that returns the successive date i.e. the new value of the parameters corresponding to the desired month, day and year applying toStringO to the date 12-01-2000 produces "December 1st, 2000" date object. For example, applying nextDate) to the date 12-31-2000 produces a new date: 01-01-2001. You should take into account if the year is a leap year or not A leap year is: (1) divisible by 400 or (2) divisible by 4 and not divisible by 100 . The function compareDates) that checks if the date of interest is before, after or equal to the argument date A simple run of the driver program follows 12-32-2000 Enter the first date using the format mm-dd-yyyy: Incorrect day! Enter the first date using the format mm-dd-yyyy: 12-31-2000 The string version of the date is: December 31st, 2000 The next date in string version is: January 1st, 2001 Enter the second date using the format mm-dd-yyyy: 12-01-2001 The first date comes before the second one Another run: Enter the first date using the format mm-dd-yyyy: The string version of the date is: February 28th, 2005 The next date in string version is: March 1st, 2005 Enter the second date using the format mm-dd-yyyy: The first date comes after the second one 02-28-2005 01-10-2005

Explanation / Answer

public class CalendarClass {

private String date;

private int dd;

private int mm;

private int yyyy;

public CalendarClass() {

this.date="01-01-1990";

}

public CalendarClass(int dd,int mm,int yyyy){

String date=dd+"-"+mm+"-"+yyyy;

this.date=date;

}

@Override

public String toString() {

return "CalendarClass [date=" + date + "]";

}

public static void main(String[] args) {

CalendarClass cal=new CalendarClass();

System.out.println(cal);

CalendarClass calen=new CalendarClass(28,10,2017);

System.out.println(calen);

}

}

/*

CalendarClass [date=01-01-1990]

CalendarClass [date=28-10-2017]

*/