/*******************************************************************************
Author:				Rebecca Hasti, hasti@cs.wisc.edu
					copyright 2000, all rights reserved
Course:				CS 302, Summer 2000

Compiler:			Metrowerks CodeWarrior (JDK 1.2)
Platform:			Windows NT 4.0 (or Windows 95)
*******************************************************************************/

/**
 * An object of the Rectangle class represents a rectangle in the xy plane.
 * A rectangle consists of an upper left corner point, a height, and a width.
 *
 * Bugs:	none known
 **/
class Rectangle {

	////////////////////////////////////////
	// Data Members
	////////////////////////////////////////
	
	private Point upperLeft;		// the upper left corner point
	private double height;			// the height of the rectangle
	private double width;			// the width of the rectangle
	
	////////////////////////////////////////
	// Constructors
	////////////////////////////////////////
	
	public Rectangle(Point upperLeftPt, double h, double w) {
		upperLeft = upperLeftPt;
		height = h;
		width = w;
	}
	
	////////////////////////////////////////
	// Public Methods
	//	Point	getUpperLeft()
	//	double	getHeight()
	//	double	getWidth()
	//	double 	computeArea()
	//	double 	computerPerimeter()
	//	void	scale(double factor)
	//	void 	shift(Point p)
	////////////////////////////////////////
	
	/**
	 * Returns the upper left corner point of the rectangle.
	 * @return the upper left corner point
	 **/
	public Point getUpperLeft() {
		return upperLeft;
	}
	
	/**
	 * Returns the height of the rectangle.
	 * @return the height
	 **/
	public double getHeight() {
		return height;
	}
	
	/**
	 * Returns the width of the rectangle.
	 * @return the width
	 **/
	public double getWidth() {
		return width;
	}
	
	/**
	 * Returns the area of the rectangle.
	 * @return area of rectangle
	 **/
	public double computeArea() {
		return height * width;
	}

	/**
	 * Returns the perimeter of the rectangle
	 * @return perimeter of rectangle
	 **/
	public double computePerimeter() {
		return 2 * height + 2 * width;
	}
	
	/**
	 * Scales the dimensions of the rectangle by the given factor.
	 * Note: the factor is assumed to be positive.
	 * @param factor the factor (> 0) by which to scale the dimensions
	 **/
	public void scale(double factor) {
		height = height * factor;
		width = width * factor;
	}
	
	/**
	 * Shifts the upper left corner of the rectangle to the given point.
	 * @param p the new upper left corner of the rectangle
	 **/
	public void shift(Point p) {
		upperLeft = p;
	}
	
}
