- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDrawing1.java
More file actions
Latest commit
27 lines (18 loc) · 416 Bytes
/
Copy pathDrawing1.java
File metadata and controls
27 lines (18 loc) · 416 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
packagedrawing.version3;
importjava.util.ArrayList;
importshapes.Circle;
importshapes.Rectangle;
importshapes.Shape;
publicclassDrawing {
privateArrayList<Shape> shapes = newArrayList<Shape>();
publicdoublecalculateTotalArea(){
doubletotalArea = 0;
for (Shapesekil : shapes){
totalArea += sekil.area();
}
returntotalArea;
}
publicvoidaddShape(Shapes) {
shapes.add(s);
}
}