From 37b5fe6d52ae6ddd2349555171ad36125da488d9 Mon Sep 17 00:00:00 2001 From: Shuulker Date: Thu, 25 Jan 2024 16:35:43 -0800 Subject: [PATCH] Completed Java Assignment 002 --- .idea/misc.xml | 2 +- .idea/vcs.xml | 6 ++++++ Java-Assignment-002.iml | 1 + src/Time.java | 26 ++++++++++++++++++++++++++ 4 files changed, 34 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 639900d..172df7b 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,6 +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..ce7a7bc --- /dev/null +++ b/src/Time.java @@ -0,0 +1,26 @@ +public class Time { + public static void main(String[] args) { + + // Stating variables + double hour = 16; + double minute = 30; + double second = 41; + + // Number of seconds since midnight + System.out.print("Number of seconds since midnight: "); + System.out.println((hour * 3600) + (minute * 60) + second); + + // Seconds remaining in the day + System.out.print("Seconds remaining in the day are: "); + System.out.println(86400 - ((hour * 3600) + (minute * 60) + second)); + + // Percentage of the day + System.out.print("Percentage of the day that has passed is "); + System.out.println(((hour * 3600) + (minute * 60) + second) * 100 / 86400 + "%"); + + // Seconds since starting exercise + System.out.print("How many seconds that have passed since I started this exercise: "); + System.out.println(((hour * 3600) + (minute * 60) + second) - 57291); + + } +}