CSC1110 Homework 11

Shapes

In Java, an Interface is used to define the public methods that are shared by a given set of Objects.They are used to standardize the communication between classes, requiring all abstract methods declared in the interface to be fully implemented in the implementing classes

UML

The Shape Interface

The Shape interface defines three methods that must be implemented in all shapes that implement this interface: calculateArea(), calculatePerimeter(), and toString(). In addition, there is a constant DecimalFormat object that will be shared among all instances of the implementing classes.

Implementing Classes

There are two implementing classes, Circle and Rectangle, that will fully implement all three of those defined methods. Note that because these classes implement the Shape interface, they may be referenced either as their class or as a Shape. Use your Color enumeration from the previous homework to format the output.

Driver class

The driver class will contain only the main() method and should do the following:

Sample Output

SampleOutput

Submission Instructions:

Commit and push your project to your GitHub repository.