25 lines
461 B
Java
Executable File
25 lines
461 B
Java
Executable File
//Rectangle.java
|
|
package task4;
|
|
|
|
public class Rectangle {
|
|
double length;
|
|
double width;
|
|
|
|
public double getPerimeter() {
|
|
return (this.length + this.width) * 2;
|
|
}
|
|
|
|
public double getArea() {
|
|
return this.length * this.width;
|
|
}
|
|
|
|
public Rectangle(double length, double width) {
|
|
this.length = length;
|
|
this.width = width;
|
|
}
|
|
|
|
public Rectangle() {
|
|
this(1.0, 1.0);
|
|
}
|
|
}
|