-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRectangle.java
More file actions
23 lines (17 loc) · 952 Bytes
/
Rectangle.java
File metadata and controls
23 lines (17 loc) · 952 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
class Rectangle extends Object {
Coordinate startPoint;
float width;
float height;
Rectangle(Coordinate startPoint, float width, float height) {
super(configureCoordinates(startPoint, width, height));
}
private static printInstruction[] configureCoordinates(Coordinate startPoint, float width, float height) {
printInstruction processedData[] = new printInstruction[5];
processedData[0] = new printInstruction(startPoint.giveX(), startPoint.giveY(), false, false);
processedData[1] = new printInstruction(startPoint.giveX() + width, startPoint.giveY(), true, false);
processedData[2] = new printInstruction(startPoint.giveX() + width, startPoint.giveY() - height, true, false);
processedData[3] = new printInstruction(startPoint.giveX(), startPoint.giveY() - height, true, false);
processedData[3] = new printInstruction(startPoint.giveX(), startPoint.giveY(), true, true);
return processedData;
}
}