public class Rectangle {
private int width;
private int height;
}
public class Rectangle { private int width; private int height; public void setSmall() { //Set ivars to arbritrary small values this.width = 5; this.height = 1; } //etc (more code follows) }
public void setSmall() {
//Set ivars to arbritrary small values
width = 5;
height = 1;
}
public void setSmall() { //Set ivars to arbritrary small values this.width = 5; this.height = 1; }
public class Rectangle { private int width; private int height; public void setSmall() { //Set ivars to arbritrary small values this.width = 5; this.height = 1; } //etc (more code follows) }
public class Rectangle { private int width; private int height; public void setLarge() { //Set ivars to arbritrary large values this.width = 100; this.height = 50; } //etc (more code follows) }
public class Rectangle { private int width; private int height; public1int2getWidth() {3return this.4width; } //etc (more code follows) }
public class Rectangle { private int width; private int height; public int getWidth() { return this.width; } //etc (more code follows) }
public class Rectangle { private int width; private int height; public int getWidth() { return this.width; } //etc (more code follows) }
public class Rectangle { private int width; private int height; public int getHeight() { return this.height; } //etc (more code follows) }
public class Rectangle { private int width; private int height; public String toString() { //Return a "nice" display string return "" + this.width + " x " + this.height; } //etc (more code follows) }
public class Rectangle { private int width; private int height; public void setSmall() { //Set ivars to arbritrary small values this.width = 5; this.height = 1; } public void setLarge() { //Set ivars to arbritrary large values this.width = 100; this.height = 50; } //------------------------------------------ //Getters public int getWidth() { return this.width; } public int getHeight() { return this.height; } //------------------------------------------ //Common public String toString() { //Return a "nice" display string return "" + this.width + " x " + this.height; } }