Skip to content

Commit 26caa12

Browse files
Completed Assignments
1 parent 46a36c7 commit 26caa12

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

‎ch02/Time.java‎

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,19 @@ public static void main(String[] args)
55
double hour = 16.0;
66
double minute = 24.0;
77
double second = 10.0;
8-
second =(hour*3600.0) + (minute*60.0) + second; //converted hours and minutes into seconds
9-
System.out.println("Number of seconds since midnight: " + second);
8+
double secondsSince =(hour*3600.0) + (minute*60.0) + second; //converted hours and minutes into seconds
9+
System.out.println("Number of seconds since midnight: " + secondsSince);
1010

11-
second = (24.0*3600.00) - second;
12-
System.out.println( "Number of seconds until midnight: " + second);
11+
double secondsUntil = (24.0*3600.00) - secondsSince;
12+
System.out.println( "Number of seconds until midnight: " + secondsUntil);
1313

1414
double day = hour + (minute/60.0);
1515
System.out.println("Percentage of day passed: " + ( day / 24.00 ) * 100.00);
1616

17-
18-
double start = (hour + (minute/60.0)) / ((36.0/60.0) + 15.0);
17+
double x = 15.0; //start hour
18+
double y = 36.0; //start minute
19+
//double z = 30.0; //start second
20+
double start = (hour + (minute/60.0)) - ( x + (y/60.0));
1921
System.out.println( "Elapsed Time: " + start);
2022

2123
}

0 commit comments

Comments
 (0)