- Put 5 quadrilaterals into hierarchical relationship with each other using classes.
- Pick 5 to 8 attributes to talk about for your quadrilaterals. For example, if you pick "number of sides", each of your 5 types of quadrilaterals should be able to print its number of sides.
- When I look at your code, I should only see a definition of a variable in a new class if the variable changed value. For example, number_of_sides should never need to be written after you define your Quadrilateral class.
- At the end of your program, write a print statement for each of your types of quadrilaterals. This means you will print all 5 quadrilaterals. You should print: the name/classification of the quadrilateral and each of your chosen attributes (from step 2).
Organize the following types of quadrilaterals into a hierarchical class structure based on angle measures, congruent sides, etc. Particularly, I want you to use inheritance of class properties when creating children classes.
Types of Quadrilaterals:
First, I suggest starting by making sure you know how each of the types relate to the others. A family tree would be helpful in this case.
URL for Quadrilateral Heirarchy: http://www.sawyoo.com/postpic/2012/02/quadrilateral-family-tree_516390.jpg
Next, create a class called quadrilaterals. Be sure to give it an __init__ function with "self" as an argument
Properties of quadrilaterals.
- Type of Quadrilateral (Classification)
(For example, a rhombus is a parallelogram and a kite and a quadrilateral)
- 4 sides.
- Opposite angles
- Opposite sides
- Adjacent angles
- Adjacent sides
-bisect each other?
If you've not taken Geometry yet:
Properties of Quadrilaterals are listed at this website.
And at this website.
You could start like this and then show me how you would only need to change the class variables
#Properties of generic quadrilaterals
Classification = "Quadrilateral" #this will change once you get into specific Quadrilaterals.
Num_Sides = "4"
#every class needs one of these.
#We won't use it just yet since these classes are all about changing variables via inheritance.
#printing the properties of quadrilaterals
print("Properties of: \n Quadrilaterals")
#I'm sick of writing "Quadrilateral" all the way out. Shortcut!
Quad = Quadrilateral