What's wrong with my codes? It doesn't display any clock timer???

FratBro23
Category:
Programming
Price: $5 USD

Question description

public class ICS112_1ISB_Quiz1_OBE_Dionisio_35

{

private int hr;

private int min;

private int sec;

public void setTime(int hours, int minutes, int seconds)

{

if (0 <= hours && hours < 24)

hr = hours;

else 

hr = 0;

if (0 <= minutes && minutes < 60)

min =  minutes;

else 

min = 0;

if (0 <= seconds && seconds <60)

sec = seconds;

else 

sec = 0;

}

public int getHours()

{

return hr;

}

public int getMinutes()

{

return min;

}

public int getSeconds()

{

return sec;

}

public void printTime()

{

if (hr < 10)

System.out.print("0");

System.out.print(hr + ":");

if (min < 10)

System.out.print("0");

System.out.print(min + ":");

if (min < 10)

System.out.print("0");

System.out.print(sec);

}

public void incrementHours()

{

hr++;

if (hr > 23)

hr = 0;

}

public void incrementMinutes()

{

min++;

if (min > 59)

{

min = 0;

incrementHours();

}

}

public void incrementSeconds()

{

sec++;

if (sec > 59)

{

sec = 0;

incrementMinutes();

}

}

}


Tutor Answer

(Top Tutor) Daniel C.
(997)
School: Duke University
PREMIUM TUTOR
Studypool has helped 1,244,100 students
Ask your homework questions. Receive quality answers!

Type your question here (or upload an image)

1826 tutors are online

Brown University





1271 Tutors

California Institute of Technology




2131 Tutors

Carnegie Mellon University




982 Tutors

Columbia University





1256 Tutors

Dartmouth University





2113 Tutors

Emory University





2279 Tutors

Harvard University





599 Tutors

Massachusetts Institute of Technology



2319 Tutors

New York University





1645 Tutors

Notre Dam University





1911 Tutors

Oklahoma University





2122 Tutors

Pennsylvania State University





932 Tutors

Princeton University





1211 Tutors

Stanford University





983 Tutors

University of California





1282 Tutors

Oxford University





123 Tutors

Yale University





2325 Tutors