Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Rectangle extends Shape {
- private int width;
- private int height;
- public int getArea() {
- return height * width;
- }
- public String toString() {
- return "The Rectangle has a width of " + width + " and a height of " + height + super.toString();
- }
- public int getWidth() {
- return width;
- }
- public void setWidth(int newWidth) {
- this.width = newWidth;
- }
- public int getHeight() {
- return height;
- }
- public void setHeight(int newHeight) {
- this.height = newHeight;
- }
- Rectangle() {
- super(4);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement