7.1 Requirements of the position classes

To predict when an aircraft will arrive at the airport, we need to know the speed of the aircraft relative to the ground, and the distance the aircraft is from the airport. Thus, we need to represent the positions of objects, such as airports and aircraft, to compute distances.

We shall use two ways to express the position of an object. First, we use latitude and longitude to indicate the absolute position of the object. Second, we describe the position of the object relative to a second object. For example, a particular aircraft might be 200 miles west of a given airport. This kind of description is a relative position.

We shall define the classes <absolute-position> and <relative-position>. The slots of <absolute-position> will store information about the latitude or longitude of that position. The slots of <relative-position> will include a distance (such as 200 miles), and a direction (such as south).

We need to provide say methods for absolute and relative positions. The following sample calls show the output that we want to achieve:

? say(*my-absolute-position*);
42 degrees 19 minutes 34 seconds North latitude
70 degrees 56 minutes 26 seconds West longitude
? say(*her-relative-position*);
30 miles away at heading 90 degrees