Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

using python 3 :# your new code goes here, instantiate twoPoint objects. Given that two points fall on the circumference of a circle, find and

using python 3:# your new code goes here, instantiate twoPoint objects. Given that two points fall on the circumference of a circle, find and display the center and radius of that circle.

class Point:

def __init__(self, initX, initY): """ Create a new point at the given coordinates """ self.__x = initX self.__y = initY

def getX(self): """ Get its x coordinate """ return self.__x

def getY(self): """ Get its y coordinate """ return self.__y

def __str__(self): """ Return a string representation of the point """ return "({}, {})".format(self.__x, self.__y)

def halfway(self, other): """ Create a point halfway between self and other """ mx = (self.__x + other.__x) / 2 my = (self.__y + other.__y) / 2 return Point(mx, my)

def distFromOrigin(self): """ Return the distance from self to (0,0) """ return (self.__x**2 + self.__y**2)**0.5

def distFrom(self, other): """ Return the distance from self to other """ return ((self.__x - other.__x)**2 + (self.__y - other.__y)**2)**0.

# your new code goes here

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions