Create a python program for the following details: Create an abstract class Shape Under Shape create abstract methods name, sides, and color. Create subclasses of Shape with the name Square, Pentagon, and Triangle. Under each subclass, implement the methods name, sides, and color with the following details. Square: print "Square", "I have 4 sides", "My color is yellow" Pentagon: print "Pentagon", "I have 5 sides", "My color is blue" Triangle: print "Triangle", "I have 3 sides", "My color is red" Create an instance of each subclasses. Ask the user for an input. (Assume the user will input 3, 4, or 5 only) if the user input 3- print the details of an object of subclass Triangle if the user input 4 - print the details of an object of subclass Square if the user input 5- print the details of an object of subclass Pentagon
Create a python program for the following details: Create an abstract class Shape Under Shape create abstract methods name, sides, and color. Create subclasses of Shape with the name Square, Pentagon, and Triangle. Under each subclass, implement the methods name, sides, and color with the following details. Square: print "Square", "I have 4 sides", "My color is yellow" Pentagon: print "Pentagon", "I have 5 sides", "My color is blue" Triangle: print "Triangle", "I have 3 sides", "My color is red" Create an instance of each subclasses. Ask the user for an input. (Assume the user will input 3, 4, or 5 only) if the user input 3- print the details of an object of subclass Triangle if the user input 4 - print the details of an object of subclass Square if the user input 5- print the details of an object of subclass Pentagon
Chapter11: Advanced Inheritance Concepts
Section: Chapter Questions
Problem 3PE
Related questions
Question
Code Using Python
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 3 steps with 1 images
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
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,