Im struggling on the project I set myself. I want the user to be able to input the time, but it needs to be legal (i.e if the time is 9:15 and they add 4 hours, it must be 01:15 Please help!
package time;
public class NewTime {
int hh, mm;
public NewTime(int hh, int mm) {
if (hh > 0 && hh < 24 && mm > 0 && mm < 60) {
this.hh = hh;
this.mm = mm;
}
}
public void addTime(int hh, int mm) {
if (mm + this.mm > 59) {
this.hh += mm / 60;
}
this.hh += hh;
this.mm += mm;
}
}