-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRectangle12.java
More file actions
48 lines (37 loc) · 1.01 KB
/
Rectangle12.java
File metadata and controls
48 lines (37 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package lab6;
public class Rectangle12 extends Shape {
private double width;
private double height;
public Rectangle12(){}
public Rectangle12(double width, double height) {
this.width = width;
this.height = height;
}
public Rectangle12(double width, double height, String color, boolean filled)
{
super(color,filled);
this.width = width;
this.height = height;
}
public double getPerimeter()
{
return 2*(this.height + this.width);
}
public double getDiameter()
{
return 2*(this.height + this.width);
}
public double getArea()
{
return this.height*this.width;
}
/**
*
* @return
*/
@Override
public String toString()
{
return "Height is: " +this.height + " Width is:" +this.width + " Permimeter is "+this.getPerimeter() + " Area is:" +this.getArea();
}
}