Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Java-Assignment-002.iml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
26 changes: 26 additions & 0 deletions src/Time.java
Original file line number Diff line number Diff line change
@@ -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);

}
}