Milo Chang
Avanish Gupta
/** Represents a rectangle
*/
public class Rectangle extends Quadrilateral {
/** Makes a rectangle given a length and width
*/
public Rectangle(double length, double width) {
super(length, width, length, width);
}
@Override
public double Area() {
return sideOne * sideTwo; // from the constructor length is sideOne and width is sideTwo
}
/** Determines whether a rectangle with a given length and width is equivalent to the given rectangle
*/
public boolean isEquivalent(double length, double width) {
return super.isEquivalent(length, width, length, width);
}
}
Β© 2024 Fiveable Inc. All rights reserved.