Ellipse.java
/**
A simple <code>Ellipse</code> class for homework #2.
@author Walt Leipold
*/
public class Ellipse extends Shape implements PrinterPlottable
{
/**
Construct an <code>Ellipse</code> object.
@param x x-coordinate of center
@param y y-coordinate of center
@param w width
@param h height
*/
public Ellipse(double x,double y,double w,double h)
{
super(x,y);
this.width = w;
this.height = h;
}
/**
@return the width of this <code>Ellipse</code>
*/
public double getWidth()
{
return width;
}
/**
@return the height of this <code>Ellipse</code>
*/
public double getHeight()
{
return height;
}
/**
@return a <code>String</code> describing this <code>Ellipse</code>
*/
public String toString()
{
return getClass().getName() + "[" +
"x=" + formatNum(getX()) + "," +
"y=" + formatNum(getY()) + "," +
"w=" + formatNum(width) + "," +
"h=" + formatNum(height) + "]";
}
/**
Draw the <code>Ellipse</code> on the given plot context
using a specified character.
@param pc <code>PlotContext</code> to draw on
@param drawChar character used to draw shape
*/
public void draw(PlotContext pc,char drawChar)
{
// Haven't had time to write this one...
}
private double width,height;
}