Index: doc/theses/jiada_liang_MMath/planet.cfa
===================================================================
--- doc/theses/jiada_liang_MMath/planet.cfa	(revision 57e43cd62d1d5b574873c756a2da768784ade542)
+++ doc/theses/jiada_liang_MMath/planet.cfa	(revision 57e43cd62d1d5b574873c756a2da768784ade542)
@@ -0,0 +1,52 @@
+#include <fstream.hfa>
+#include <stdlib.hfa>
+#include <enum.hfa>
+
+struct MR { double mass, radius; };
+
+enum( MR ) Planet {
+        //          mass (kg)  radius (km)
+        MERCURY = { 0.330_E24, 2.4397_E6 },
+        VENUS   = { 4.869_E24, 6.0518_E6 },
+        EARTH   = { 5.976_E24, 6.3781_E6 },
+        MOON    = { 7.346_E22, 1.7380_E6 }, // not a planet
+        MARS    = { 0.642_E24, 3.3972_E6 },
+        JUPITER = { 1898._E24, 71.492_E6 },
+        SATURN  = { 568.8_E24, 60.268_E6 },
+        URANUS  = { 86.86_E24, 25.559_E6 },
+        NEPTUNE = { 102.4_E24, 24.746_E6 },
+};
+
+enum( double ) { G = 6.6743_E-11 }; // universal gravitational constant (m3 kg-1 s-2)
+
+static double surfaceGravity( Planet p ) with( p ) {
+        return G * mass / ( radius \ 2 ); // exponentiation
+}
+static double surfaceWeight( Planet p, double otherMass ) {
+        return otherMass * surfaceGravity( p );
+}
+
+int main( int argc, char * argv[] ) {
+        if ( argc != 2 ) exit | "Usage: " | argv[0] | "earth-weight";
+
+        double earthWeight = convert( argv[1] );
+        double earthMass = earthWeight / surfaceGravity( EARTH );
+
+        Planet p = fromInt( prng( __count_e__( Planet ) ) ); // select a random orbiting body
+//      Planet p = fromInt( prng( 9 ) ); // select a random orbiting body
+        choose( p ) {
+          case MERCURY, VENUS, EARTH, MARS:
+                sout | labelE( p ) | "is a rocky planet";
+          case JUPITER, SATURN, URANUS, NEPTUNE:
+                sout | labelE( p ) | "is a gas-giant planet";
+          default:
+                sout | labelE( p ) | "is not a planet";
+        }
+
+
+        for ( p; enum Planet ) {
+                sout | "Your weight on "
+                 | (p == MOON ? "the" : "") | labelE(p)
+                         | "is" | wd( 1,1, surfaceWeight( p, earthMass ) ) | "kg";
+        }
+}
