Question: JAVA shape so far: //create an abstract Shape class abstract class Shape { static int shapeCount = 0; public Shape() { //shapeCount is incremented every

JAVA

JAVA shape so far: //create an abstract Shape class abstract class Shape

shape so far:

//create an abstract Shape class abstract class Shape { static int shapeCount = 0; public Shape() { //shapeCount is incremented every time a new shape is created shapeCount = shapeCount + 1; } //define abstract methods area(), perimeter(), and getShape() abstract double area(); abstract double perimeter(); //getShape() will return a String that represents a particular shape abstract String getShape(); }

1. Create an interface Displayable that contains one void method display(). 2. Modify the Shape class so that it implements Displayable. The display() method for Shape should print out its type, area, and perimeter, in some format of your choice. 3. In the Shape Tester class, make a method displayArray that takes as its argument a ArrayList of Shapes. Your method should loop through the array and display each element. Call this method on the array you created above

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!