point.py - #File Name#Purpose#Author#Date point.py Class to...

This preview shows page 1 out of 1 page.

##File Name: point.py #Purpose: Class to represent a point located at coordinates x, y #Author: Adelaida Medlock #Date: January 13, 2020 import math class Point: # static attribute __count = 0 # to count how many points we have created so far # initialization method def __init__ (self, x = 0, y = 0): #default arguments technique self.__x = x self.__y = y Point.__count += 1 #updating the Point count # getters def getX(self): return self.__x def getY(self): return self.__y def printPoint(self): return '(' + str(self.__x) + ', ' + str(self.__y) + ')' # setters def setPoint(self, x, y): self.__x = x self.__y = y def reset(self): self.setPoint(0, 0) # other methods

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture