Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed
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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advanced Oracle Solaris 11 System Administration

Authors: Bill Calkins

1st Edition

0133007170, 9780133007176

More Books

Students also viewed these Databases questions