Answered step by step
Verified Expert Solution
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: trianglename, side side side
Instance methods:
constructor: it initializes all the instance variables
calcperimeter: this method returns the perimeter of the triangle, calculated using: perimeter side side side
calcarea: this method returns the area of the triangle using:
where area
ame: this method returns the name 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
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started