-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRectangle.java
More file actions
43 lines (41 loc) · 837 Bytes
/
Rectangle.java
File metadata and controls
43 lines (41 loc) · 837 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
36
37
38
39
40
41
42
43
public class Rectangle extends ShapeBasic implements RectangleInterface {
private int width, length;
public Rectangle()
{
super(); //Call to ShapeBasic default constructor
this.width = this.length = 1;
}
public Rectangle(int anOffset, int aW, int aL)
{
super(anOffset); //Call to ShapeBasic parameterized constructor
this.set(aW, aL);
}
public int getWidth()
{
return this.width;
}
public int getLength()
{
return this.length;
}
public void set(int aW, int aL)
{
if(aW >= 1 && aL >= 1)
{
this.length = aL;
this.width = aW;
}
}
public void drawHere() //Override
{
for(int i = 0; i < this.length; i++)
{
skipSpaces(super.getOffset());
for(int j = 0; j < this.width; j++)
{
System.out.print("*");
}
System.out.println();
}
}
}