diff --git a/.idea/misc.xml b/.idea/misc.xml index 6e86672..69ace3f 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,5 +1,6 @@ + - + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Java-Assignment-002.iml b/Java-Assignment-002.iml index b46c0dd..e1006ff 100644 --- a/Java-Assignment-002.iml +++ b/Java-Assignment-002.iml @@ -5,6 +5,7 @@ + \ No newline at end of file diff --git a/src/Time.java b/src/Time.java new file mode 100644 index 0000000..96d2850 --- /dev/null +++ b/src/Time.java @@ -0,0 +1,17 @@ +public class Time { + public static void main(String[] args) { + int hour = 20; + int minute = 44; + int second = 22; + int midnight = 24; + float secondInDay = 86400; + int fromMidnight = hour*3600 + minute*60 + second; + int untilMidnight = midnight*3600 - fromMidnight; + float percentOfDay = fromMidnight/secondInDay; + System.out.println(fromMidnight + " seconds from midnight." + "\n" + untilMidnight + " seconds until midnight." + + "\n" + percentOfDay + " percent of the day has passed."); + // modified values + System.out.println(((hour + 1)*3600 + (minute - 39)*60 + second + 20) - (hour*3600 + minute*60 + second) + + " seconds have passed since I have started this assignment."); + } +}