-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTestShape.java
More file actions
30 lines (26 loc) · 743 Bytes
/
TestShape.java
File metadata and controls
30 lines (26 loc) · 743 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
import java.util.ArrayList;
/*
Brock Francom
A02052161
CS-2410
Andrew Brim
1/29/2019
This class is used to test the shape class by creating a list of shape objects
and calling the overridden getArea method on each object.
*/
public class TestShape {
public static void main(String[] args) {
ArrayList<Shape> shapes = new ArrayList<>();
shapes.add(new Square(5));
shapes.add(new Square(10));
shapes.add(new Triangle(2));
shapes.add(new Triangle(6.2));
shapes.add(new Pyramid(1));
shapes.add(new Pyramid(40));
shapes.add(new Cube(30));
shapes.add(new Cube(55));
for (Shape shape:shapes) {
System.out.println(shape.getArea());
}
}
}