The application is a simple orbit calculation program. The following parameters will apply:

  • The input describes a set of orbiting bodies followed by some queries. A complete sample is in the file sample-input in the top-level folder of your working directory. It looks like:
    Sun 57909227 Mercury
    Earth 384400 Moon
    Sun 149598262 Earth
    Moon 1757 LROrbiter
    Mars 9376 Phobos
    Mars 23458 Deimos
    Sun 227943824 Mars
    Sun 778340821 Jupiter
    Sun 1426666422 Saturn
    Sun 2870658186 Uranus
    Sun 4498396441 Neptune
    Sun Moon
    Deimos Moon
    Deimos
    Deimos Phobos
    Moon
    LROrbiter
    You should not edit this, although of course you could add similar samples for your own testing purposes.
  • There is also a complete sample output in the file sample-output in the same folder. It contains:
    From Sun to Moon is 149982662km
    From Deimos to Moon is 377949944km
    Deimos orbits Mars Sun
    From Deimos to Phobos is 32834km
    Moon orbits Earth Sun
    LROrbiter orbits Moon Earth Sun
    You should also not edit this. For assignments 2, 3, and 4, you may want to directly compare the output of your program with this file; instructions are in each assignment.
  • Each line of the input has 1 to 3 words, the meanings of which are:
    1. print a line identifying the objects that the named object orbits
    2. print a line showing the distance between the object, where distance is the sum of the orbits. For example in the line Deimos Phobos it is the sum of the distance from Deimos to Mars and the distance from Mars to Phobos. For Deimos Moon, it is the sum of: Deimos to Mars, Mars to Sun, Sun to Earth, Earth to Moon.
    3. Establish that the last object orbits the first object at a distance from the second field. For example Earth 384400 Moon means that the Moon orbits the Earth at a distance of 384,400 km.
  • Except for Smalltalk, the programs will read from standard input and write on standard output.
  • This is sample input. We will test with different input following the same rules. There could be 100s of orbits.
  • In addition to any tests or test data we provide, you must have unit tests for the components of your program, verifying that they perform correctly. This will be worth 20% of the mark.