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

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

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!