Philip P. Ide

Author, programmer, science enthusiast, half-wit.
Life is sweet. Have you tasted it lately?

User Tools

Site Tools


blog:articles:software:age_and_weight_calc

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
blog:articles:software:age_and_weight_calc [2019/03/09 17:26] – created Phil Ideblog:articles:software:age_and_weight_calc [2019/03/10 23:04] (current) Phil Ide
Line 1: Line 1:
 ====== Calculate your Age and Weight on the Planets ====== ====== Calculate your Age and Weight on the Planets ======
 This little calculator allows you to calculate how old you would be on each of the planets in the solar system, and what your weight would be. If you have weight issues, don't look at the result for Jupiter! LOL This little calculator allows you to calculate how old you would be on each of the planets in the solar system, and what your weight would be. If you have weight issues, don't look at the result for Jupiter! LOL
 +
 +The results are based on surface gravity, which for the gas and ice-giants is somewhat less than you might think. Data is taken from NASA/JPL
 +
 +//N.B. None of this information is stored or even sent to my server, it's calculated in your browser//
 === === === ===
 |Your date of birth|<html><input type=date id=__dob /input></html>| |Your date of birth|<html><input type=date id=__dob /input></html>|
Line 9: Line 13:
 <JS> <JS>
 var planets = [ var planets = [
- {name: "Mercury", year: 87.9691, mass: 0.0553}, + {name: "Mercury", year: 87.9691, mass: 0.38}, 
- {name: "Venus", year: 224.701, mass: 0.815},+ {name: "Venus", year: 224.701, mass: 0.91},
  {name: "Earth", year: 365.25, mass: 1.0},  {name: "Earth", year: 365.25, mass: 1.0},
- {name: "Mars", year: 686.971, mass: 0.107}, + {name: "Mars", year: 686.971, mass: 0.38}, 
- {name: "Jupiter", year: 4332.59, mass: 317.8}, + {name: "Jupiter", year: 4332.59, mass: 2.34}, 
- {name: "Saturn", year: 10759.22, mass: 95.2}, + {name: "Saturn", year: 10759.22, mass: 0.93}, 
- {name: "Uranus", year: 30688.5, mass: 14.6}, + {name: "Uranus", year: 30688.5, mass: 0.92}, 
- {name: "Neptune", year: 60182, mass: 17.2}+ {name: "Neptune", year: 60182, mass: 1.12}
 ]; ];
- 
 function __calculateweightandage(){ function __calculateweightandage(){
 var s = "<table><tr><th></th><th>Age</th><th>Weight</th></tr>"; var s = "<table><tr><th></th><th>Age</th><th>Weight</th></tr>";
Line 32: Line 35:
   var weight = Math.round(w*planets[i].mass*100)/100;   var weight = Math.round(w*planets[i].mass*100)/100;
   weight = new Intl.NumberFormat('en-IN', { maximumSignificantDigits: 2 }).format(weight);   weight = new Intl.NumberFormat('en-IN', { maximumSignificantDigits: 2 }).format(weight);
 +  if( planets[i].name == "Earth" ) weight = w;
 +  
   s += '<tr><th>'+planets[i].name+'</th><td align=right>'+a+' yrs</td><td align=right>'+weight+' '+u+'</td></tr>';   s += '<tr><th>'+planets[i].name+'</th><td align=right>'+a+' yrs</td><td align=right>'+weight+' '+u+'</td></tr>';
 i++; i++;
Line 39: Line 44:
 }; };
 </JS> </JS>
 +~~socialite~~
  
blog/articles/software/age_and_weight_calc.1552152373.txt.gz · Last modified: 2019/03/09 17:26 by Phil Ide

Except where otherwise noted, content on this wiki is licensed under the following license: Copyright © Phil Ide
Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki