Basic Planetary Data
HP Prime Basic Planetary Data
The program PLANETS and PLANETDATA retrieve data about our solar system planets, including our dwarf planet, Pluto.
PLANETS presents you with a choose menu which will present a screen of all the data for a planet.
PLANETDATA allows you to retrieve a specific item for a planet. PLANETDATA has two arguments: n for the planet, k for the data point. This is useful if you want to pull out a specific data point for calculations.
Table for PLANETDATA(n, k):
Code:
Value Planet (n) Data Point (k)
1 Mercury Name of the Planet
2 Venus Radius (km)
3 Earth Mass (kg)
4 Mars Gravity (m/s^2)
5 Jupiter Density (g/cm^3)
6 Saturn Axial tilt (°)
7 Uranus Period (days)
8 Neptune Number of Moons
9 Pluto (dwarf planet)
Example:
The gravity on Mars. PLANETDATA(4,4) returns 3.71 m/s^2.
The diameter of Saturn. PLANETDAT(6,2) returns 58,232 km.
HP Prime Program: PLANETS
Code:
EXPORT PLANETS()
BEGIN
// Solar System Data
// solarsystem.nasa.gov
// EWS 2016-09-25
LOCAL head, data, n, k, str;
head:={"Planet","Radius (km)",
"Mass (kg)","Gravity (m/s^2)",
"Density (g/cm^3)",
"Axial tilt (°)",
"period (days)",
"# Moons"};
data:={{"Mercury",2439.7,
3.30104ᴇ23,3.7,5.427,.034,
58.646,0},
{"Venus",6051.8,
4.86732ᴇ24,8.87,5.243,177.36,
243.018,0},
{"Earth",6371,
5.9722ᴇ24,9.80665,5.513,23.4393,
365.24,1},
{"Mars",3389.5,
6.4169ᴇ23,3.71,3.934,25.19,
687,2},
{"Jupiter",69911,
1.89813ᴇ27,24.79,1.326,3.1,
4332.59,67},
{"Saturn",58232,
5.68319ᴇ26,10.4,.687,26.7,
10759.22,62},
{"Uranus",25362,
8.68103ᴇ25,8.87,1.27,97.8,
30688.5,27},
{"Neptune",24622,
1.0241ᴇ26,11.15,1.638,28.3,
60182,14},
{"Pluto",1151,
1.3090ᴇ22,0.66,2.05,122.53,
90560,5}
};
CHOOSE(n,"Planet",{"Mercury","Venus",
"Earth","Mars","Jupiter","Saturn",
"Uranus","Neptune"});
// Print Screen
PRINT();
FOR k FROM 1 TO SIZE(head) DO
str:=head(k)+": "+data(n,k);
PRINT(str);
END;
RETURN "Done.";
END;
HP Prime Program: PLANETDATA
Code:
EXPORT PLANETDATA(n,k)
BEGIN
// Solar System Data
// solarsystem.nasa.gov
// Individual data
// Get data on the fly
// EWS 2016-09-25
LOCAL head, data;
head:={"Planet","Radius (km)",
"Mass (kg)","Gravity (m/s^2)",
"Density (g/cm^3)",
"Axial tilt (°)",
"period (days)",
"# Moons"};
data:={{"Mercury",2439.7,
3.30104ᴇ23,3.7,5.427,.034,
58.646,0},
{"Venus",6051.8,
4.86732ᴇ24,8.87,5.243,177.36,
243.018,0},
{"Earth",6371,
5.9722ᴇ24,9.80665,5.513,23.4393,
365.24,1},
{"Mars",3389.5,
6.4169ᴇ23,3.71,3.934,25.19,
687,2},
{"Jupiter",69911,
1.89813ᴇ27,24.79,1.326,3.1,
4332.59,67},
{"Saturn",58232,
5.68319ᴇ26,10.4,.687,26.7,
10759.22,62},
{"Uranus",25362,
8.68103ᴇ25,8.87,1.27,97.8,
30688.5,27},
{"Neptune",24622,
1.0241ᴇ26,11.15,1.638,28.3,
60182,14},
{"Pluto",1151,
1.3090ᴇ22,0.66,2.05,122.53,
90560,5}
};
IF n==0 THEN
RETURN head;
ELSE
RETURN data(n,k);
END;
END;
Sources:
NASA Solar System Exploration. https://solarsystem.nasa.gov/
Wikipedia. https://en.wikipedia.org/wiki/Main_Page
We pages retrieved during September 21, 2015 to September 25, 2015
|