// Time class, representing time as hours and minutes since midnight class Time { public static int timezone = 60; public final static Time noon = new Time(12, 0); private int hours, min; // since midnight Time(int hours, int min) { this.hours = hours; this.min = min; } public Time(int hours) { this.hours = hours; } public Time(Time t) { hours = t.hours; min = t.min; } public int getHours() { return hours; } public int getMin() { return min; } public String toString() { return hours + "." + min; } public Time plus(int min) { int totalmin = 60 * this.hours + this.min + min; return new Time(totalmin / 60, totalmin % 60); } public int to(Time t) { return 60 * t.hours + t.min - 60 * hours - min; } public boolean before(Time t) { return hours < t.hours || hours == t.hours && min <= t.min; } public void flyt(int min) { int totalmin = 60 * this.hours + this.min + min; this.hours = totalmin / 60; this.min = totalmin % 60; } public void flyt(int hours, int min) { int totalmin = 60 * this.hours + this.min + 60 * hours + min; this.hours = totalmin / 60; this.min = totalmin % 60; } }