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

  Write a python program to implement the diff command

Without using the system() function to call any bash commands, write a python program that will implement a simple version of the diff command.

  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.

  Prepare a python program

Prepare a Python program which evaluates how many stuck numbers there are in a range of integers. The range will be input as two command-line arguments.

  Python atm program to enter account number

Write a simple Python ATM program. Ask user to enter their account number, and print their initail balance. (Just make one up). Ask them if they wish to make deposit or withdrawal.

  Python function to calculate two roots

Write a Python function main() to calculate two roots. You must input a,b and c from keyboard, and then print two roots. Suppose the discriminant D= b2-4ac is positive.

  Design program that asks user to enter amount in python

IN Python Design a program that asks the user to enter the amount that he or she has budget in a month. A loop should then prompt the user to enter his or her expenses for the month.

  Write python program which imports three dictionaries

Write a Python program called hours.py which imports three dictionaries, and uses the data in them to calculate how many hours each person has spent in the lab.

  Write python program to create factors of numbers

Write down a python program which takes two numbers and creates the factors of both numbers and displays the greatest common factor.

  Email spam filter

Analyze the emails and predict whether the mail is a spam or not a spam - Create a training file and copy the text of several mails and spams in to it And create a test set identical to the training set but with different examples.

  Improve the readability and structural design of the code

Improve the readability and structural design of the code by improving the function names, variables, and loops, as well as whitespace. Move functions close to related functions or blocks of code related to your organised code.

  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.

  The program is to print the time

The program is to print the time in seconds that the iterative version takes, the time in seconds that the recursive version takes, and the difference between the times.

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