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..c9c93c4 --- /dev/null +++ b/src/Time.java @@ -0,0 +1,20 @@ +public class Time { + public static void main(String[] args) { + int hour = 14; // You can change this value to the current hour. + int minute = 30; // You can change this value to the current minute. + int second = 45; // You can change this value to the current second. + + int minutepast = 14; + + int secondsSinceMidnight = (hour * 3600) + (minute * 60) + second; + int secondsRemainingInDay = (24 * 3600) - secondsSinceMidnight; + int timeElapsed = (minute - minutepast); + + double percentageOfDayPassed = (double) secondsSinceMidnight / (secondsSinceMidnight + secondsRemainingInDay) * 100; + + System.out.println("The number of seconds since midnight is: " + secondsSinceMidnight); + System.out.println("The number of seconds remaining in the day is: " + secondsRemainingInDay); + System.out.println("The percentage of the day that has passed is: " + percentageOfDayPassed + "%"); + System.out.println("Minutes since starting this project: " + timeElapsed); + } +} \ No newline at end of file