Another Example - int getDay(): returns the day of the...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
Another Example Exercise 4.25 from Cohoon and Davidson: Develop and implement a class Date that represents a date. A Date object should have 3 attributes: day of the month, the month, the year. The class should provide the following constructors: a no argument constructor that configures a new date that represents January 1, 2000. a constructor that configures a new date with the day, month and year as parameters. The class should provide the following behaviors:
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: int getDay(): returns the day of the associated date. int getMonth() int getYear() void setDay(int d) void setMonth(int m) void setYear(int y) String toString(): returns a text representation of the Date object. Also write a DateTest class that creates several Date objects using information which is read from the user, and prints a String representation of each date....
View Full Document

Ask a homework question - tutors are online