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

  Calculate the total displacement of the system of springs

Calculate the total displacement of the system of springs - You are free to use any linear system solver from chapter 6, including the solvers that are part of the SciPy and/or numpy packages.

  Without using the system function to call any bash commands

without using the system function to call any bash commands write a python program that will implement a simple version

  Write python program isosceles tri equilateral tri rectangle

Write python program Isosceles Tri Equilateral Tri Rectangle, Write another "driver" script called project1.py which imports the polygon.py module, reads an input file of polygonal data and writes another file of areas and perimeters.

  Write a program to convert an input value from base

Write a program to convert an input value from base 10 to a user selectable base between 2 and 16.

  Write a python program that starts from the starting state

Task consists of programming a Python implementation of a solver for the Desert Crossing Task - write a Python program that starts from the starting state.

  Write a python program that reads the contents of the data

Design an algorithm and use it to write a Python program that reads the contents of the data file into a list. The program should then loop, to allow a user to check various numbers against those stored in the list.

  Project will be a simple, working program

This programming project will be a simple, working program, using Python language, which utilizes a good design process and includes:Sequential, selection, and repetitive programming statements as well as,At least one function call.

  Code for the haunted house game

Improve the game by adding more features, for example you can examine more items, more props etc. You may implement this using more lists regarding items and props, remember, you should check if the object is being carried or in the location of th..

  Write a program that produces a comparison of the balance

Write a program that produces a comparison of the balance of a bank account over time between simple, monthly and daily methods of compounding interest.

  Program that allows the user to enter the type of coin

Create a program that allows the user to enter the type of coin to be evaluated and the number of coins. The program should calculate the total weight of the coins and the height of the coins when stacked. Name the program coins.py. Use the table bel..

  Most popular name would be the one with the biggest number

the program will ask you to insert the year that the user is interested in, then ask the gender that the user is interested in, and print out the most popular names corresponding to the year and gender. FYI, the number on the right represents how man..

  Write a python program

Write a Python program

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