Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Can you adapt the sample python code for this activity? As an enhancement, please implement the Triangle class. It should have base, height, sideLeft and

Can you adapt the sample python code for this activity?

image text in transcribed

image text in transcribed

image text in transcribed

As an enhancement, please implement the Triangle class. It should have base, height, sideLeft and sideRight properties. Improve the program so that the user can perform the followings: 1) Add a shape In this case the program should ask the user to choose the type of the shape (e.g., rectangle, circle, or triangle) and require proper user input depending on the shape (in addition to id, name, and borderColor). Then, the shape should be created and added to a list. 3) Display a single shape In this option, the shapes (stored in a list) should be listed by their Id and Name. The user should enter the Id of the shape, and the system should print all properties of the shape (e.g., base, height, sideleft and sideRight for a triangle) as well as its Area and Parameter. 2) List all shapes In this option, the shapes should be listed by their Id and Name. import math cass shape: class Rectangle(Shape): def __init _(self, id, name, bordercolor, width, length): self.width=width self.length=length super().__init _(id, name, bordercolor) def CalculatePerimeter ( self): return 2 * (self. length + self.width) def CalculateArea(self) : return self, length * self.width ss circle(Shape): , bordercolor

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_2

Step: 3

blur-text-image_3

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

Database Systems For Advanced Applications 9th International Conference Dasfaa 2004 Jeju Island Korea March 2004 Proceedings Lncs 2973

Authors: YoonJoon Lee ,Jianzhong Li ,Kyu-Young Whang

2004th Edition

3540210474, 978-3540210474

More Books

Students also viewed these Databases questions

Question

Does the sequence an sin 2 n converge?

Answered: 1 week ago

Question

What is operatiing system?

Answered: 1 week ago

Question

2. Outline the functions of nonverbal communication

Answered: 1 week ago