Question: Java Language with Comments please Lab 3 - Classes and Objects The purpose of this lab is to learn how to declare classes and how

Java Language with Comments please Lab 3 - Classes and Objects TheJava Language with Comments please

Lab 3 - Classes and Objects The purpose of this lab is to learn how to declare classes and how to create objects. Description Declare class Date with attributes"day", "month" and "year" that represent a date. Furthermore, in class Date, Declare a constructor with parameters "day", "month and year and a constructor with parameters "day" and "month (use the current year for attribute year); one constructor will call the other Declare getters and setters Declare method toString() that formats the date as follows: 12/31/2017 Declare class Instant with a single attribute seconds. The objects of this class will represent a time instant. In class Instant, Declare method toString() that formats the instant as follows: 00:04:30 Declare method add() with a parameter of type Instant that adds the time instant represented by the parameter to "this instant Declare class Time with attributes "hour,"minute" and "second" that represent a time within a day. In class Time, Declare overloaded constructor; one constructor will call the other Declare getters and setters Declare method toString() that formats the time as follows: 05:23:15 Declare method add() with a parameter of type Instant; the method will add the time represented by the parameter to "this time Declare method diff() with a parameter of type Time that returns the difference between this" and the parameter (the return type will be Instant) In the main method, show the use of every declared method and constructor (except getters and setters)

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!