Space age

in #ita25 days ago

class SpaceAge {

static double age(String planet, int seconds) {

    if(planet.equals("Mercury")) return Math.round(seconds /(0.2408467\*31557600)\*100)/100

    else if(planet.equals("Venus")) return Math.round(seconds /(0.61519726\*31557600)\*100)/100

    else if(planet.equals("Earth")) return Math.round(seconds /31557600 \*100)/100

    else if(planet.equals("Mars")) return Math.round(seconds /(1.8808158\*31557600) \*100)/100

    else if(planet.equals("Jupiter")) return Math.round(seconds /(11.862615\*31557600) \*100)/100

    else if(planet.equals("Saturn")) return Math.round(seconds /(29.447498\*31557600) \*100)/100

    else if(planet.equals("Uranus")) return Math.round(seconds /(84.016846\*31557600) \*100)/100

    else return Math.round(seconds /(164.79132\*31557600) \*100)/100

}

}