Methods Summary |
---|
public void | displayH()
System.out.println("The hour is " + h);
// The method body
|
public void | displayM()
System.out.println("The minute is " + m);
// The method body
|
public void | displayS()
System.out.println("The second is " + s);
// The method body
|
public void | setTime(int hour, int min, int sec)
if ((hour>=0)&&(hour<24)&&(min>=0)&&(min < 60)&&(sec>=0)&&(sec<60))
{
h=hour;
m=min;
s=sec;
}
else
System.out.println("Illegal time");
|
public void | tick()
s++;
if (s==60)
{
s=0;
m++;
}
if (m==60)
{
m=0;
h++;
}
if (h==24)
h=0;
|