Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Rectangle {
- private double width = 1;
- private double length = 1;
- public Rectangle() {
- }
- public Rectangle(double width, double length) {
- this.width = width;
- this.length = length;
- }
- public double getWidth() {
- return width;
- }
- public void setWidth(double width) {
- this.width = width;
- }
- public double getLength() {
- return length;
- }
- public void setLength(double length) {
- this.length = length;
- }
- public double getArea() {
- return this.width * this.length;
- }
- public double getPerimeter() {
- return 2 * (this.width + this.length);
- }
- @Override
- public String toString() {
- return "Rectangle[length=" + this.length + ", width=" + this.width + "]";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement