The time is set as hh:mm:ss, so time is 23:50:45, once it hits midnight it will turn to 00:00:00. A practise question for my exam has asked me to write a method to do this, is my logic right or away off, I am concerned about my if else statements
public void increment()
{
if(seconds <= 59)
{
seconds ++;
}
else if (seconds >= 60 && minutes<= 59)
{
seconds == 0;
minutes ++;
}
if(minutes >= 60 && hours <= 23)
{
hours++;
minutes == 0;
}
else
{
hours == 0;
}
}
You can do the same thing much easier.