From 7848ef8049437e79ae8e4bb16016a6f836289ff0 Mon Sep 17 00:00:00 2001 From: CreeperKelten Date: Sun, 28 Jan 2024 21:23:25 -0800 Subject: [PATCH] Kelten Stowe --- .idea/misc.xml | 3 ++- .idea/vcs.xml | 6 ++++++ Java-Assignment-002.iml | 1 + src/Time/Time.java | 31 +++++++++++++++++++++++++++++++ 4 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 .idea/vcs.xml create mode 100644 src/Time/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/Time.java b/src/Time/Time.java new file mode 100644 index 0000000..3a5f56b --- /dev/null +++ b/src/Time/Time.java @@ -0,0 +1,31 @@ +//Author Kelten +//Date 1/28/24 +//Editors note sorry again for the last minute turn in I'll try and be better I'm still ajusting to college sense this is my first semester + +package Time; + +public class Time { + public static void main(String[] args) { + // Step 2: Gives us are time and variables + int hour = 14; // 2:00 PM + int minute = 30; + int second = 0; + // Step 3: Checks all the numbers and makes it a actual clock + int secondsSinceMidnight = hour * 3600 + minute * 60 + second; + System.out.println("Seconds since midnight: " + secondsSinceMidnight); + // Step 4: Displays and shows the seconds sense Midnight + int secondsInADay = 24 * 3600; + int secondsRemaining = secondsInADay - secondsSinceMidnight; + System.out.println("Remaining seconds in the day: " + secondsRemaining); + // Step 5: Calculate and display the percentage of the day that has passed + double percentageOfDayPassed = ((double) secondsSinceMidnight / secondsInADay) * 100; + System.out.println("Percentage of the day left: " + percentageOfDayPassed + "%"); + // Step 6: Changes values to show the time + int currentHour = 16; // Assuming it's 4:00 PM now + int currentMinute = 45; + int currentSecond = 30; + // Calculate and display the time + int elapsedSeconds = (currentHour - hour) * 3600 + (currentMinute - minute) * 60 + (currentSecond - second); + System.out.println("Elapsed time since starting: " + elapsedSeconds + " seconds"); + } +} \ No newline at end of file