Smalltalk problem

Job ID: 33146573

Budget: $30 – $250 CAD

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

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.

Call your main class Orbits.
Your Orbits instances must have a from: method that accepts a string which contains the whole mult-line input and returns the result string. Your Orbits class must also have a from: method that creates an instance of itself and returns the result of sending it the string.
Related categories: Object Oriented Programming (OOP)