Quick Index
Overview


This page contains the method menus for this chapter's work.

NOTE WELL -- These object types (and methods) are all available in the context (environment) for any problem in this chapter.

Rectangle Method Menu


Our rectangle has a left top corner and width and height.

This is a two dimension shape and the orientation/plane of the shape may be horizontal (e.g., a roof), or vertical (e.g., a wall), or any orientation in between. Height does not imply vertical height.

Regarding the left top base point (corner), the x-axis is to the rightward and y-axis is upward.

/** Returns new Rectangle with all properties set to 0 */
static newInstance()

/**
 * Returns new Rectangle that is a square with width and height both
 *     set to method param "aSide", left and top are set to 0
*/
static fromSide(aSide)

/**
 * Returns new Rectangle with width and height set to passed
 * method params, left and top are set to 0
*/
static fromWidthHeight(w, h)

/**
 * Returns new Rectangle with left, top, width and height
 * set to matching passed params
*/
static fromLeftTopWidthHeight(left, top, w, h)

/** Returns array of Rectangle objects */
static newSampleSet1()

/** Construct rectangle with the passed param dimensions */
constructor(left, top, w, h)

/** Returns ivar label (getter) */
getLabel()

/** Returns ivar width (getter) */
getWidth()

/** Returns ivar height (getter) */
getHeight()

getLeft()

getTop()

/** Returns area of rectangle */
getArea()

/** Returns perimeter of rectangle */
getPerimeter()

/** Returns diagonal distance of rectangle */
getDiagonal()

/** Sets ivar label (setter) */
setLabel(aLabel)

/**
 * Returns true if this rectangle contains the passed point
 * (sides are inclusive)
*/
contains(aPoint)

/** Returns nice display string for this Rectangle */
toString()


City Method Menu


/**
 * Returns new City object with passed name,
 * country, lat and long values
*/
static fromNameCountryLatLong(name, country, lat, lon)

/**
 * Returns new City object with blank name and country
 *   and location (0, 0)
*/
static newInstance()

/** Returns array of African cities */
static newSampleSet1()

/** Constructs GeoLocation with passed lat and long values */
constructor(nm, country, lat, lon)

/** Returns city name */
getName()

/** Returns country city is located in */
getCountry()

/** Returns location of city (a GeoLocation object) */
getLocation()

/** Returns latitude of city */
getLatitude()

/** Returns longitude of city */
getLongitude()

/** Returns true if this location is in the northern hemisphere */
isInNorthernHemisphere()

/** Returns true if this location is in the southern hemisphere */
isInSouthernHemisphere()

/** Returns true if this location is north of passed latitude */
isNorthOf(otherCity)

/** Returns true if this location is south of passed latitude */
isSouthOf(otherCity)

/** Returns nice display string for this City */
toString()

/** Returns string "city, country" */
toCityCountryString()


GeoLocation Method Menu


GeoLocation implements (satisfies) the Point contract/interface because it handles getX() and getY().

/** Returns new GeoLocation object with passed latitude and longitude values */
static fromLatLong(lat, lon)

/** Returns instance of a GeoLocation with values (0, 0) */
static newInstance()

/**
 * Constructs GeoLocation with passed lat and long values
 * e.g., new GeoLocation(45.076076, -93.332728)
*/
constructor(aLatitude, aLongitude)

/** Returns latitude */
getLatitude()

/** Returns longitude */
getLongitude()

/** Sets latitude to passed parameter */
setLatitude(lat)

/** Sets longitude to passed parameter */
setLongitude(lon)

/** Returns longitude - compatibility with "Point" contract/interface */
getX()

/** Returns latitude - compatibility with "Point" contract/interface */
getY()

/** Returns true if this location is in the northern hemisphere */
isInNorthernHemisphere()

/** Returns false if this location is in the northern hemisphere */
isInSouthernHemisphere()

/** Returns perimeter of this rectangle */
isOnEquator()

/** Returns true if this location is north of passed latitude */
isNorthOfLatitude(aLatitude)

/** Returns true if this location is south of passed latitude */
isSouthOfLatitude(aLatitude)

/** Returns "nice string" of this rectangle */
toString()


Mathematician Method Menu


/** Returns new Mathematician object using passed param values */
static fromFirstLastCountryGenderKnownFor(first, last, country, gender, knownFor)

/** Returns a sample set of Mathematicians for play */
static newSampleSet1()

/** Constructs Mathematician with passed name components and phone */
constructor(first, last, country, gender, knownFor)

/** Returns full name as string */
getFullName()

/** Returns country ivar (getter) */
getCountry()

/** Returns gender ivar (getter) */
getGender()

/** Returns knownFor ivar (getter) */
getKnownFor()

/** Returns nice display string for this Mathematician */
toString()


ToolLib Method Menu


/**
 * Returns the distance from pntA to pntB (in miles)
 * 	p1 and p2 are in lat and long. The objects p1 and p2 must
 * 	satisfy the "Point" contract/interface (getX and getY).
*/
static latLongDistFromTo(pntA, pntB)