File tree 1 file changed +37
-0
lines changed
1 file changed +37
-0
lines changed Original file line number Diff line number Diff line change
1
+ package easy ;
2
+
3
+ /**
4
+ * Have the function TimeConvert(num) take the num parameter being passed
5
+ * and return the number of hours and minutes the parameter converts to
6
+ * (i.e. if num = 63 then the output should be 1:3).
7
+ * Separate the number of hours and minutes with a colon.
8
+ */
9
+ public class TimeConvert {
10
+
11
+ /**
12
+ * Time Convert function.
13
+ *
14
+ * @param num input number
15
+ * @return the number of hours and minutes
16
+ */
17
+ private static String timeConvert (int num ) {
18
+ int hours = num / 60 ;
19
+ int minutes = num % 60 ;
20
+ return hours + ":" + minutes ;
21
+ }
22
+
23
+ /**
24
+ * Entry point.
25
+ *
26
+ * @param args command line arguments
27
+ */
28
+ public static void main (String [] args ) {
29
+ var result1 = timeConvert (63 );
30
+ System .out .println (result1 );
31
+ var result2 = timeConvert (178 );
32
+ System .out .println (result2 );
33
+ var result3 = timeConvert (249 );
34
+ System .out .println (result3 );
35
+ }
36
+
37
+ }
You can’t perform that action at this time.
0 commit comments