Browse Source

gofmt

master
Blaine Motsinger 1 year ago
parent
commit
59f9aa5eee
1 changed files with 21 additions and 21 deletions
  1. 21
    21
      go/space-age/space_age.go

+ 21
- 21
go/space-age/space_age.go View File

@@ -2,17 +2,17 @@
package space

// Age converts age in seconds to years on the requested planet
func Age(seconds float64, planet string) (float64) {
func Age(seconds float64, planet string) float64 {

// years in seconds on each planet
const (
EarthYear = 31557600
EarthYear = 31557600
MercuryYear = EarthYear * 0.2408467
VenusYear = EarthYear * 0.61519726
MarsYear = EarthYear * 1.8808158
VenusYear = EarthYear * 0.61519726
MarsYear = EarthYear * 1.8808158
JupiterYear = EarthYear * 11.862615
SaturnYear = EarthYear * 29.447498
UranusYear = EarthYear * 84.016846
SaturnYear = EarthYear * 29.447498
UranusYear = EarthYear * 84.016846
NeptuneYear = EarthYear * 164.79132
)

@@ -20,21 +20,21 @@ func Age(seconds float64, planet string) (float64) {

switch planet {
case "Earth":
actual = seconds / EarthYear
case "Mercury":
actual = seconds / MercuryYear
case "Venus":
actual = seconds / VenusYear
case "Mars":
actual = seconds / MarsYear
case "Jupiter":
actual = seconds / JupiterYear
case "Saturn":
actual = seconds / SaturnYear
case "Uranus":
actual = seconds / UranusYear
case "Neptune":
actual = seconds / NeptuneYear
actual = seconds / EarthYear
case "Mercury":
actual = seconds / MercuryYear
case "Venus":
actual = seconds / VenusYear
case "Mars":
actual = seconds / MarsYear
case "Jupiter":
actual = seconds / JupiterYear
case "Saturn":
actual = seconds / SaturnYear
case "Uranus":
actual = seconds / UranusYear
case "Neptune":
actual = seconds / NeptuneYear
}

return actual

Loading…
Cancel
Save