class Rectangle
//Returns new Rectangle with width and height set to zero. static newRectangle() //Returns new Rectangle that is a square with width and height both //set to method param "aSide" static fromSide(aSide) //Returns new Rectangle with width and height set to passed method params static fromWidthHeight(aWidth, aHeight)
Rectangle | +------- width ------- an integer | +------- height -- an integer
class Rectangle { }
class Rectangle {
/*
width - the width dimension of a rectangle (an integer)
height - the height dimension of a rectangle (an integer)
*/
}
//Returns new Rectangle with width and height set to zero. static newRectangle() { //TODO } //Returns new Rectangle that is a square with width and height both //set to method param "aSide" static fromSide(aSide) { //TODO } //Returns new Rectangle with width and height set to passed method params static fromWidthHeight(aWidth, aHeight) { //TODO }
public Rectangle(aWidth, aHeight)
//Returns new Rectangle with width and height set to zero. static newRectangle() { return Rectangle.fromWidthHeight(0, 0); } //Returns new Rectangle that is a square with width and height both //set to method param "aSide" static fromSide(aSide) { return Rectangle.fromWidthHeight(aSide, aSide); } //Returns new Rectangle with width and height set to passed method params static fromWidthHeight(aWidth, aHeight) { return new Rectangle(aWidth, aHeight); } //-------------------------------------------------------------- //Private (Classic) Constructors //Classic constructor that accepts width and height params constructor(aWidth, aHeight) { this.width = aWidth; this.height = aHeight; }