Create an interface EnhancedShape that extends Shape (From question 3)
Write a program in java language
Create an interface EnhancedShape that extends Shape (From question 3)
and also requires a method public double perimeter( ) to be implemented
by any class that uses the interface.
Question 3
Define an interface named Shape with a single method named area that
calculates the area of the geometric shape: public double area(); Next,
define a class named Circle that implements Shape . The Circle class should
have an instance variable for the radius, a constructor that sets the radius,
accessor/ mutator methods for the radius, and an implementation of the
area method. Also define a class named Rectangle that implements Shape .
The Rectangle class should have instance variables for the height and
width, a constructor that sets the height and width, accessor and mutator
methods for the height and width, and an implementation of the area
method.
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images