u may only use print(), input(), len(), typecasting functions. a. Write a Python class definition for a geometric shape - the quadrilateral. A quadrilateral is characterized by four points in the Cartesian coordinate system. Each point is a pair of numbers (x, y) which are the Cartesian coordinates. In your class definition, provide the following methods - getters/setters to return/set each point as a tuple, print all four points of the quadrilateral, distance between any two points of the quadrilateral. Test your class by creating objects and calling each of the methods. b. Modify your class in Problem a. to create two more classes, one for a Pentagon (5 Cartesian points, one for each corner) and one for a Hexagon (6 Cartesian points, one for each corner). Add a new method to determine the sum of lengths of all the sides in addition to the methods in Problem a

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter8: Arrays And Strings
Section: Chapter Questions
Problem 24PE
icon
Related questions
Question
In python. Don't use pictures.they aren't showing
Mon Jan 31 7:3
ofiles
Window
Help
Tab
Using vectors and matrices in
myView Welcome
вь 2752959
SP2022-SP: Com x
t.blackboardcdn.com/5b158bd279e57/2752959?X-Blackboard-Expiration=1643695200000&X-Blackboard-Signature...
O Facebook
P OWL /| Purdue Wri..
I United Negro Coll.
O Adobe Creative C..
E Readi
myView Homepage
H GVmail Outlook
1 / 2
153%
op to sum up the itemS in a list.
u may only use print), input), len(), typecasting functions.
a. Write a Python class definition for a geometric shape - the quadrilateral. A quadrilateral
is characterized by four points in the Cartesian coordinate system. Each point is a pair of
numbers (x, y) which are the Cartesian coordinates. In your class definition, provide the
following methods - getters/setters to return/set each point as a tuple, print all four points
of the quadrilateral, distance between any two points of the quadrilateral. Test your class
by creating objects and calling each of the methods.
b. Modify your class in Problem a. to create two more classes, one for a Pentagon (5 Cartesian
points, one for each corner) and one for a Hexagon (6 Cartesian points, one for each
corner). Add a new method to determine the sum of lengths of all the sides in addition to
the methods in Problem a
MacBook Air
DII
DD
F4
F5
F6
F7
F8
F9
F10
F11
F12
&
*
7
8
9
Transcribed Image Text:Mon Jan 31 7:3 ofiles Window Help Tab Using vectors and matrices in myView Welcome вь 2752959 SP2022-SP: Com x t.blackboardcdn.com/5b158bd279e57/2752959?X-Blackboard-Expiration=1643695200000&X-Blackboard-Signature... O Facebook P OWL /| Purdue Wri.. I United Negro Coll. O Adobe Creative C.. E Readi myView Homepage H GVmail Outlook 1 / 2 153% op to sum up the itemS in a list. u may only use print), input), len(), typecasting functions. a. Write a Python class definition for a geometric shape - the quadrilateral. A quadrilateral is characterized by four points in the Cartesian coordinate system. Each point is a pair of numbers (x, y) which are the Cartesian coordinates. In your class definition, provide the following methods - getters/setters to return/set each point as a tuple, print all four points of the quadrilateral, distance between any two points of the quadrilateral. Test your class by creating objects and calling each of the methods. b. Modify your class in Problem a. to create two more classes, one for a Pentagon (5 Cartesian points, one for each corner) and one for a Hexagon (6 Cartesian points, one for each corner). Add a new method to determine the sum of lengths of all the sides in addition to the methods in Problem a MacBook Air DII DD F4 F5 F6 F7 F8 F9 F10 F11 F12 & * 7 8 9
Expert Solution
Step 1: Python code for question 'a'

a)

Python code for the required scenario:

class quadrilateral:

    def __init__(self, a1, a2, b1, b2, c1, c2, d1, d2):

        self.a1 = a1

        self.a2 = a2

        self.b1 = b1

        self.b2 = b2

        self.c1 = c1

        self.c2 = c2

        self.d1 = d1

        self.d2 = d2

    def get_points(self):

        return self.a1, self.a2, self.b1, self.b2, self.c1, self.c2, self.d1, self.d2

    def set_points(self, A1, A2, B1, B2, C1, C2, D1, D2):

        self.a1, self.a2 = A1, A2

        self.b1, self.b2 = B1, B2

        self.c1, self.c2 = C1, C2

        self.d1, self.d2 = D1, D2

    def distance(x1, x2, y1, y2):

        return ((x2-x1)^2 + (y2-y1)^2)^0.5

m= quadrilateral()

m.set_points(2,3,5,4,0,3,1,2)

print( m.get_poits())

print(m.distance(2,0,3,1))

 

trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps

Blurred answer
Knowledge Booster
Topological Sort
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning