Implement a triangle class in python

Assignment Help Python Programming
Reference no: EM131050597

Project-

A printout showing the codes developed and outputs produced for the tests indicated. Deadline is strictly observed.

A. Implement a Triangle class in Python:

1. The triangle is defined by its three side lengths - a, b, and c.

2. The class includes methods that perform the following operations:

a. is_triangle - checks whether the given side lengths form a proper triangle;

b. area - returns the area of the triangle if properly formed; None otherwise;

c. perimeter - returns the perimeter of the triangle if properly formed; None otherwise;

d. a_angle, b_angle, c_angle - returns the vertex angle opposite to side a, side b, and side c, respectively, if the triangle is properly formed; None otherwise;

e. angles - returns the angles of the triangle;

f. __str__ - returns a string representation of a triangle object: side lengths, angles, perimeter, and area;

g. draw_triangle - draws a triangle of the given parameters using turtle. Test the Triangle class given the following data sets: (a, b, c) = (100, 100, 72), (100, 100, 100√2), (100, 50, 50).

B. Implement a Isosceles subclass of the Triangle class in Python:

1. The isosceles is defined by the side length - a - of the two equal sides and the angle formed by the two sides - angle -- in degrees.

2. The class includes or inherits methods that perform the following operations:

a. is_triangle - checks whether the given side lengths constitute a proper triangle;

b. area - returns the area of the triangle;

c. perimeter - returns the perimeter of the triangle;

d. a_angle, b_angle, c_angle - returns the vertex angle opposite to side a, side b, and side c, respectively;

e. angles - returns the angles of the triangle;

f. __str__ - returns a string representation of a triangle object: side lengths, angles, perimeter, and area;

g. draw_triangle - draws a triangle of the given parameters using turtle.

Test the Isosceles class given the following data sets: (a, angle) = (100, 72), (100, 90), (100, 60).

 C. Implement a PieChart class in Python:

1. The class includes or inherits a method that draws a pie chart of a given data set {(key, value)|1,2, . . ,n } using turtle:

a. The area of a slice of the pie chart is proportional to the percentage of an item value in the data set;

b. Each slice of the pie chart has a different color;

c. The pie chart has a legend that visually shows or relates the pie chart slices to their corresponding keys and values.

Test the PieChart class using the set of frequency of letters in "Words.txt" file -- {(letter, frequency)|1,2, . . ,n} -- you obtained in a previous exercise or project.

Reference no: EM131050597

Questions Cloud

Calculate the cumulative incidence of deaths : (a) normal weight, (b) slightly overweight, (c) moderately overweight and (d) greatly overweight. 57,145 deaths from cancer occurred in the population during the follow-up period. Calculate the cumulative incidence of deaths from cancer among the ..
Write a research proposal for a media and communication : ACX702 Communication Research methods - Research Proposal - Write a comprehensive research proposal for a media and communication-related research study you would like to undertake using Chapters 3 & 5 in the textbook as a guide.
Results for the four designs : All 40 balls were hit in a short period of time, during which the environmental conditions were essentially the same. The results for the four designs were as follow:
Write a seven page paper about who you are as a manger : Write a seven page paper about who you are as a manger, what you believe in (in the eyes of a manager) and what kind of organization you will be effective in as a manager.
Implement a triangle class in python : CSc 11300 Spring 2016 Programming Languages. Implement a Triangle class in Python: The triangle is defined by its three side lengths - a, b, and c. The class includes methods that perform the following operations: is_triangle - checks whether the giv..
Cumulative incidence of chicken pox : None of those lost to follow-up had developed chicken pox prior to becoming lost. Assume that you can get chicken pox only once. What is the cumulative incidence of chicken pox in this population during the one-year period from January 1st through..
Impact of new accounting pronouncements in the footnotes : 1. Companies disclose the impact of new accounting pronouncements in the footnotes to their financial statements(Usually in the Summary of Significant Accounting Policies).
Difference between coke and new coke : What are the null and alternative hypothesis? What is the decision rule or at what value would you reject H0? What is the calculated test statistic?
Explain how you would overcome potential barriers : Identify two potential barriers that could occur in your communication scenario and then explain how you would overcome them. Write your answer(s) below.

Reviews

Write a Review

Python Programming Questions & Answers

  Compare programming with python and programming with scratch

Compare programming with python and programming with scratch. Describe the same program you might create in both programming languages.

  Console program where you will implement

Create a console program where you will implement coding constructs and variables that are needed for this program and will implement the code within Main and any required static methods.

  Python programming to solve this problem

Write a statement that adds 1 to deansList and prints studentName to standard out if gpa exceeds 3.5.

  The computer game function collision

The computer game function collision () checks whether two circular objects collide; it returns True if they do and False otherwise. Each circular object will be given by it's radius and the (x,y) coordinates of it's center.

  Implement your algorithm in python

Write a Python program that, for every transaction, takes input on the customer ID and the total sale amount in the transaction.

  Creation of a program that will assemble dna chains

The aim of this assignment is the creation of a program that will assemble DNA chains, using the fragments given

  Create a simple and responsive gui

Please use primarily PHP or Python to solve the exercise and create a simple and responsive GUI, using HTML, CSS and JavaScript.Do not use a database.

  You are tasked with improving the code for the haunted

you are tasked with improving the code for the haunted house game. please read the associated hand-out and the code

  Write a program for checking a circle

Write a program for checking a circle program must either print "is a circle: YES" or "is a circle: NO", appropriately.

  The initial number for generating the sequences

Then, after the functions, read in the initial number for generating the sequences. Here, check that it is a positive integer. If it is not, give an error message and exit the program.

  The interest rate per period

The interest rate per period. For example, if your loan's interest is 6.5% per year, and you are paying monthly, this would be 6.5%/12. If you are paying every two weeks, r would be 6.5%/26, because there are 26 two-week periods in a year.

  In this assignment you will write a program that does

in this assignment you will write a program that does simple packet routing. your program will take three command-line

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd