Question: Complete the Time class and a Main class to test it. public class Time { private int hour; // 0 - 23 private int min;
Complete the Time class and a Main class to test it.
public class Time { private int hour; // 0 - 23 private int min; // 0 - 59 private int sec; // 0 - 59 //use "this" in making constructors public Time(int hour, int min, int sec) { } public Time(int hour, int min) { // sec = 0 } public Time(int hour) { // min = sec = 0 } public Time() { // hour = min = sec = 0 } //setter and getter public void setTime() { } public int getHour() { } public int getMin() { } public int getSet() { } //print time as HH:MM:SS public void printTime() { } //compute difference between finishTime and beginTime public static Time duration(Time begin, Time finish){ } } Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
