mirror of https://github.com/01-edu/public.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
877 B
22 lines
877 B
4 years ago
|
## Dog Years
|
||
|
|
||
|
### Instructions
|
||
|
|
||
|
Someone once said that a dog makes 7 years for each human year.
|
||
|
|
||
|
Create a `dogYears` function that if given a planet name and an age in seconds,
|
||
|
calculates how old a dog would be on the given planet.
|
||
|
|
||
|
- Earth: orbital period 1.0 Earth years, 365.25 Earth days, or 31,557,600 seconds
|
||
|
- Mercury: orbital period 0.2408467 Earth years
|
||
|
- Venus: orbital period 0.61519726 Earth years
|
||
|
- Mars: orbital period 1.8808158 Earth years
|
||
|
- Jupiter: orbital period 11.862615 Earth years
|
||
|
- Saturn: orbital period 29.447498 Earth years
|
||
|
- Uranus: orbital period 84.016846 Earth years
|
||
|
- Neptune: orbital period 164.79132 Earth years
|
||
|
|
||
|
So if you were told someone that their dog were 1,000,000,000 seconds old, you should be able to say that the dog is 221.83 Earth-years old.
|
||
|
|
||
|
You will have to format the number so that the result is rounded like the example above.
|