Build a simple time calculator machine that can convert a given number of seconds into the applicable highest time unit (years, months, days, hours or minutes) 

Program

Write a program to express the given time in seconds to the highest possible time unit.

Input

  • The number of seconds.

Output 

  • The number of seconds expressed in the highest time unit.

Assumptions

  • Round the value of highest time unit to two decimal places.
  • The result value is an approximation and not an accurate conversion.
  • A month have 30 days.
  • A year has 365 days, leap year is not considered.

Requirements

For calculating the highest time unit using the following criteria:

  • If the time is less than 1 minute, express it in seconds.
  • If the time is less than 1 hour, express it in minutes.
  • If the time is less than 1 day, express it in hours.
  • If the time is less than 1 month seconds, express it in weeks.
  • If the time is less than 1 year, express it in months.
  • If the time is greater than equal than 1 year, express it in years.

Test cases

No
Input
(Time in seconds)
Output
 (Approx rounded time in highest unit > 1 )
1
5555 seconds
2
1502.50 minutes
3
8460
2.35 hours
4
3326403.85 days
5
121824004.70 months
6
381585601.23 years

Instructions 

  • Accept the seconds elapsed as a whole number input via the command line argument. 
  • Write the logic to compute the highest applicable unit and convert time in seconds to that unit, round the answer to two decimal places.
  • Display the result.