Question: The program will contain 2 classes: YourInitialsDate contains The data fields year, month, and day that represent a date. Month is 0-based, ie., 0 is

The program will contain 2 classes:

YourInitialsDate contains

The data fields year, month, and day that represent a date. Month is 0-based, ie., 0 is for January. (remember to precede all variables with your initials): For example, I would use psYear, psMonth, psDay.

A no-arg constructor that creates a YourInitalsDate object for the current date.

A constructor that constructs a YourInitialsDate object with a specified long elapsedTime argument since midnight, January 1, 1970, in milliseconds.

A constructor that constructs a YourInitials object with the specified year, month, and day.

this. this.yourinitialsYear = yourinitialsYear;

..month and day

Hint: The first two constructors will extract the year, month, and day from the elapsed time. For example, if the elapsed time is 561555550000 milliseconds, the year is 1987, the month is 9 and the day is 18. You may use the GregorianCalendar class discussed in Programming Exercise 9.5 to simplify coding.

Three getter methods for year, month and day.

A method named setDate(long elapsedTime) that sets a new date for the object used elapsed time.

Write a JAVA test program YourIntialsTestApp that will include the main method that will create two YourInitialsDate objects (using new YourInitalsDate (34355555133101L) and displays their year, month, and day.

Sample Run:

year: 2022

month: 10

day: 7

year: 1987

month: 9 day: 18

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!