blue.shapes
Class Rectangle

java.lang.Object
  |
  +--blue.shapes.Rectangle

public class Rectangle
extends java.lang.Object
implements Shape

A 'rectangle' is modeled in terms its height and its width, both real numbers.


Constructor Summary
Rectangle(double h, double w)
          Create a circle.
 
Method Summary
 double area()
          Returns the area of the rectangle.
 void describe()
          Write a description of this rectangle to the standard output file.
 void describe(OutStream os)
          Write a description of this rectangle to the given OutStream.
 void describe(java.io.PrintStream pss)
          Write a description of this rectangle to the given PrintStream.
 double diagonal()
          Returns the diagonal of the rectangle.
 void expandHeight(double f)
          Expand the height of the given rectangle.
 void expandWidth(double f)
          Expand the width of the given rectangle.
 double height()
          Returns the height of the rectangle.
 double perimeter()
          Returns the perimeter of the rectangle.
 void shrinkHeight(double f)
          Shrink the height of the given rectangle.
 void shrinkWidth(double f)
          Shrink the width of the given rectangle.
 double width()
          Returns the width of the rectangle.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Rectangle

public Rectangle(double h,
                 double w)
Create a circle.
Parameters:
h - the height of the rectangle.
w - the width of the rectangle.
Method Detail

height

public double height()
Returns the height of the rectangle.

width

public double width()
Returns the width of the rectangle.

diagonal

public double diagonal()
Returns the diagonal of the rectangle.

area

public double area()
Returns the area of the rectangle.
Specified by:
area in interface Shape

perimeter

public double perimeter()
Returns the perimeter of the rectangle.

describe

public void describe()
Write a description of this rectangle to the standard output file.
Specified by:
describe in interface Shape

describe

public void describe(java.io.PrintStream pss)
Write a description of this rectangle to the given PrintStream.
Specified by:
describe in interface Shape
Parameters:
ps - the PrintStream to which the description is written.

describe

public void describe(OutStream os)
Write a description of this rectangle to the given OutStream.
Specified by:
describe in interface Shape
Parameters:
os - the OutStream to which the description is written.

shrinkWidth

public void shrinkWidth(double f)
Shrink the width of the given rectangle.
Parameters:
d - the amount by which to shrink the width.

expandWidth

public void expandWidth(double f)
Expand the width of the given rectangle.
Parameters:
d - the amount by which to expand the width.

shrinkHeight

public void shrinkHeight(double f)
Shrink the height of the given rectangle.
Parameters:
d - the amount by which to shrink the height.

expandHeight

public void expandHeight(double f)
Expand the height of the given rectangle.
Parameters:
d - the amount by which to expand the height.