import java.awt.Point; /** * Class to extend the standard java.awt.Point with a z variable for height. * * The standard Point class built into java is suitable for 2D work only. * This class extends it to provide extra functionality in the way of height. * * @author Dr Andy Evans * @version 1.0 * @see java.awt.Point java.awt.Point * **/ public class HeightPoint extends Point { /** * The new variable value. **/ private int z = 0; /** * Default constructor. **/ public HeightPoint () { super(); } /** * Extra constructor to deal with height. * @see java.awt.Point#Point(int,int) java.awt.Point#Point(int,int) * @param x : x coordinate value * @param y : y coordinate value * @param z : height value **/ public HeightPoint(int x, int y, int z) { super(x, y); this.z = z; } /** * Mutator method for height. * @param z : height value **/ public void setZ(int z) { this.z = z; } /** * Accessor method for height. * @return z : height value **/ public int getZ() { return z; } /** * Gives a String representation of the object. * Outputs "x = " + x + " y = " + y + " z = " + z. **/ public String toString() { return "x = " + x + " y = " + y + " z = " + z; } }