Question 1 In this question, you need to create an interface and an abstract class. For the interface, name it ShapeInterface and create the following methods: • An abstract method named calsarea that returns a douhle
Question 1 In this question, you need to create an interface and an abstract class. For the interface, name it ShapeInterface and create the following methods: • An abstract method named calsarea that returns a douhle
Chapter11: Advanced Inheritance Concepts
Section: Chapter Questions
Problem 5RQ
Related questions
Question
100%
![Question 1 In this question, you need to create an interface and an abstract class. For the
interface, name it ShapeInterface and create the following methods:
An abstract method named calcArea that returns a double.
• An abstract method named calcPerimeter that returns a double.
• An abstract method that overrides the toString method.
For the abstract class, name it AbstractShape and create the following methods:
• A private String instance variable m_color.
• A constructor that takes one parameter of type String and sets the instance variable
accordingly.
• A getter method getColor that returns a String.
• An abstract method named calcArea.
• An abstract method named calcPerimete.
• An abstract method that overrides the toString method (Hint: Explicitly declare this
method as public).](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Fff16a53e-7a5b-4b93-b68f-c79dc179f09f%2F4bdb39d0-32da-4726-840c-1720effcd186%2Fd78c2fr_processed.jpeg&w=3840&q=75)
Transcribed Image Text:Question 1 In this question, you need to create an interface and an abstract class. For the
interface, name it ShapeInterface and create the following methods:
An abstract method named calcArea that returns a double.
• An abstract method named calcPerimeter that returns a double.
• An abstract method that overrides the toString method.
For the abstract class, name it AbstractShape and create the following methods:
• A private String instance variable m_color.
• A constructor that takes one parameter of type String and sets the instance variable
accordingly.
• A getter method getColor that returns a String.
• An abstract method named calcArea.
• An abstract method named calcPerimete.
• An abstract method that overrides the toString method (Hint: Explicitly declare this
method as public).
Expert Solution
![](/static/compass_v2/shared-icons/check-mark.png)
Step 1
SUMMARY: -
Hence, we discussed all the points.
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
![EBK JAVA PROGRAMMING](https://www.bartleby.com/isbn_cover_images/9781337671385/9781337671385_smallCoverImage.jpg)
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
![C++ Programming: From Problem Analysis to Program…](https://www.bartleby.com/isbn_cover_images/9781337102087/9781337102087_smallCoverImage.gif)
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
![Microsoft Visual C#](https://www.bartleby.com/isbn_cover_images/9781337102100/9781337102100_smallCoverImage.gif)
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
![EBK JAVA PROGRAMMING](https://www.bartleby.com/isbn_cover_images/9781337671385/9781337671385_smallCoverImage.jpg)
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
![C++ Programming: From Problem Analysis to Program…](https://www.bartleby.com/isbn_cover_images/9781337102087/9781337102087_smallCoverImage.gif)
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
![Microsoft Visual C#](https://www.bartleby.com/isbn_cover_images/9781337102100/9781337102100_smallCoverImage.gif)
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage