Skip to content

dreamdroppin/Java-Assignment-002

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Assignment 2: Time Calculation Program

Cloning the Code

Getting Started:

  1. Fork this repository to your GitHub account.
  2. Clone the forked repository locally to your machine.
  3. Create a new branch named Feature01 to work on this exercise.

The Assignment

Objective: This exercise aims to (1) utilize arithmetic operators and (2) introduce the concept of compound entities, such as the time of day, represented by multiple values.

Instructions:

  1. Create a new Java file in the src directory named Time.java. Start with a small, working program as a foundation.
  2. Following the example program in Section 2.4 of your book, define variables named hour, minute, and second. Assign values that approximate the current time. Use a 24-hour clock (e.g., set hour to 14 for 2:00 PM).
  3. Implement the program to calculate and display the number of seconds since midnight.
  4. Extend the program to calculate and display the number of seconds remaining in the day.
  5. Further enhance the program to calculate and display the percentage of the day that has passed. Be cautious when dealing with percentages using integers; consider using floating-point numbers.
  6. Modify the values of hour, minute, and second to reflect the current time. Then, write code to compute the elapsed time since you started working on this exercise.

Hint: Consider using additional variables to hold values during computation. Variables used in computation but not displayed are sometimes referred to as "intermediate" or "temporary" variables.

Submission

Just as you did in the first lab (Reference the Lab video in your Week 1 module):

  1. create a Feature01 branch of your code if you haven't already.
  2. Commit your working code to your local copy/Feature01 branch
  3. Push it to your Remote/origin branch (i.e. GitHub: Feature01 -> origin/Feature01)
  4. Then issue a Pull request to my instructor repo
  5. Make sure to COPY the Pull request URL and submit it for the lab/assignment in Canvas.

Parting Wisdom

"Time is what we want most, but what we use worst." - William Penn

About

Initial commit

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published