Question: Create a dava program that uses an abitrast dass and mulbiple interlaces to represent different shapet. The program should have an interface calied Shape that
Create a dava program that uses an abitrast dass and mulbiple interlaces to represent different shapet. The program should have an interface calied Shape that contains a mechod caled getArea(). Another interface called Color, which contains a method called getColor[0. The abstract class Abstractshape should implement beth Shape and Color interfaces and have a pronected variable called color and a condtructor that initializes the color variable. The Abstractihape class should alse provide a commen implemantation for the setcolar0 method. Then, create two classes called Circle and flectangle that extend Abstractihage and implement the getAreal) method. In the main class, create a Circle object and a Rectarele object, and use the setAreal) and detColord methods to print the area and color of each shape." The sample output is as belew: Cirde area: 78.53981633974483 Circle color: red Mectangle area: 50.0 Rectangle color: blue
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
