From 20e6bff1c9d58425ad0bda7c8413258ac96a3533 Mon Sep 17 00:00:00 2001 From: John Date: Sat, 27 Jan 2024 18:38:31 -0800 Subject: [PATCH 1/3] commit --- .idea/misc.xml | 3 ++- .idea/vcs.xml | 6 ++++++ Java-Assignment-002.iml | 1 + src/Time.java | 30 ++++++++++++++++++++++++++++++ 4 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 .idea/vcs.xml create mode 100644 src/Time.java diff --git a/.idea/misc.xml b/.idea/misc.xml index 6e86672..172df7b 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..b6f5273 --- /dev/null +++ b/src/Time.java @@ -0,0 +1,30 @@ +public class Time { + public static void main(String[] args) { + int currentHour = 16; + int currentMinute = 30; + int currentSecond = 45; + + int secondsSinceMidnight = currentHour * 3600 + currentMinute * 60 + currentSecond; + System.out.println("Seconds since midnight: " + secondsSinceMidnight); + + int totalSecondsInDay = 24 * 3600; + int secondsRemaining = totalSecondsInDay - secondsSinceMidnight; + System.out.println("Seconds remaining in day: " + secondsRemaining); + + double percentagePassed = (secondsSinceMidnight * 100.0) / totalSecondsInDay; + System.out.println("Percentage of the day passed: " + percentagePassed + "%"); + + currentHour = 18; + currentMinute =10; + currentSecond = 30; + + int elapsedTime = (currentHour - 16) * 3600 + (currentMinute - 30) * 60 + (currentSecond - 45); + System.out.println("Time since starting the Assignment: " + elapsedTime + " seconds"); + + int elapsedMinutes = elapsedTime / 60; + int elapsedHours = elapsedMinutes / 60; + elapsedMinutes %= 60; + + System.out.println("Total elapsed time: " + elapsedHours + " hours, " + elapsedMinutes + " minutes, " + elapsedTime + " seconds."); + } +} From a427807f8a2935a3346e4a1d583651b3350e4838 Mon Sep 17 00:00:00 2001 From: John Date: Sat, 27 Jan 2024 18:46:17 -0800 Subject: [PATCH 2/3] commit --- src/Time.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Time.java b/src/Time.java index b6f5273..b92d853 100644 --- a/src/Time.java +++ b/src/Time.java @@ -24,7 +24,7 @@ public static void main(String[] args) { int elapsedMinutes = elapsedTime / 60; int elapsedHours = elapsedMinutes / 60; elapsedMinutes %= 60; - + elapsedTime %= 60; System.out.println("Total elapsed time: " + elapsedHours + " hours, " + elapsedMinutes + " minutes, " + elapsedTime + " seconds."); } } From 996723b524bf71f7fe33092684eb15d55322c780 Mon Sep 17 00:00:00 2001 From: John Date: Sat, 27 Jan 2024 18:47:48 -0800 Subject: [PATCH 3/3] commit --- src/Time.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Time.java b/src/Time.java index b92d853..7c74737 100644 --- a/src/Time.java +++ b/src/Time.java @@ -13,7 +13,7 @@ public static void main(String[] args) { double percentagePassed = (secondsSinceMidnight * 100.0) / totalSecondsInDay; System.out.println("Percentage of the day passed: " + percentagePassed + "%"); - +//updating assignment completed times currentHour = 18; currentMinute =10; currentSecond = 30;