Write a program in java language 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.
Write a program in java language
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