Content deleted Content added
Line 24:
Position class:
With a growing awareness of the wireless Internet's vast potential, many pundits expect ___location-based services to provide opportunity for the first wireless killer app. For this article's sample code, I've chosen a class representing the geographical ___location of a point on the earth's surface. As a ___domain entity, the class, named Position, represents Global Position System (GPS) information. A first cut at the class looks as simple as:
public class Position
{▼
public double latitude;▼
public double
}▼
The class contains two data items: GPS latitude and longitude. At present, Position is nothing more than a small bag of data. Nonetheless, Position is a class, and Position objects may be instantiated using the class. To utilize those objects, class PositionUtility contains methods for calculating the distance and heading -- that is, direction -- between specified Position objects:
public class PositionUtility
public static double distance( Position position1, Position position2 )▼
▲ {
// Calculate and return the distance between the specified positions.▼
▲ }
{
{
▲ // Calculate and return the distance between the specified positions.
}
{
// Calculate and return the heading from position1 to position2.
}
}
== General Definition ==
|