forked from Denisolt/CSCI-160
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTime.java
More file actions
34 lines (31 loc) · 756 Bytes
/
Time.java
File metadata and controls
34 lines (31 loc) · 756 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
//Denisolt Shakhbulatov
//24.11.2015
public class Time
{
private int hhmm;
/** Constructor
* @param HHMM military time hhmm
*/
public Time(int HHMM)
{
hhmm=HHMM;
}
/** @return difference, in minutes, between this time and other;
* difference is negative if other is earlier than this time
*/
public int minutesUntil(Time time)
{ /* implementation not shown */
int time1, time2;
time1=hhmm;
time2=time.getHhmm();
int t1 = (time1 / 100) * 60 + (time1 % 100);
int t2 = (time2 / 100) * 60 + (time2 % 100);
int min = t2 - t1;
return min;
}
/** @return the time as int */
public int getHhmm()
{
return hhmm;
}
}