forked from VenusTokyo/first-year-java-practicals
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathRectangle.java
More file actions
35 lines (27 loc) · 702 Bytes
/
Rectangle.java
File metadata and controls
35 lines (27 loc) · 702 Bytes
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
package p3;
import p1.*;
public class Rectangle extends Shape
{
private double width, height;
public Rectangle (String name, double w, double h)
{
super(name);
width = w;
height = h;
}
public double getArea()
{return width*height;}
public double getWidth()
{return width;}
public double getHeight()
{return height;}
public void setWidthHeight(double newWidth, double newHeight)
{
width = newWidth;
height = newHeight;
}
public String toString( )
{
return "Rectangle[width="+width+",height="+height+","+super.toString()+"]";
}
}