Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Design and implement the following class Class name: Triangle Instance variables: triangle _ name, side 1 , side 2 , side 3 Instance methods: constructor:

Design and implement the following class
Class name: Triangle
Instance variables: triangle_name, side1, side2, side3
Instance methods:
constructor: it initializes all the instance variables
calc_perimeter: this method returns the perimeter of the triangle, calculated using: perimeter = side 1+ side 2+ side3
calc_area: this method returns the area of the triangle using:
where area =s(s-side1)(s-side2)(s-side3)2
q,s=side1+side2+side32getname: this method returns the name of the triangle
where
Then write a Python program that reades the content of the text file "triangle.txt" and create a list of Traingle objects. Each object should be constructed from each line of the text file. The program should print the following:
A table of all triangles along with their sizes and perimeters
The triangle name that has the smallest size
triangle.txt
image text in transcribed

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

OpenStack Trove

Authors: Amrith Kumar, Douglas Shelley

1st Edition

1484212215, 9781484212219

More Books

Students also viewed these Databases questions