Question
I need help with this code, I need it updated to python 3.6 import cs1graphics #from time import sleep import cs1graphics import math print('Assignment 6.1')
I need help with this code, I need it updated to python 3.6
import cs1graphics #from time import sleep import cs1graphics import math
print('Assignment 6.1') print('Cassandra Sutton') print('04/5/2018')
print('Problem 1') class Rectangle: def __init__(self): self.x = 0 self.y = 0 def getX(self): return self.x def setX(self,k): self.x = k def setY(self,k): self.y = k def getY(self): return self.y def diagonal(self,other): dx = self._x - other._x dy = self._y - other._y return math.sqrt(dx * dx + dy * dy)
vertex = Point() print('setting vertex at top-right of rectangle coordinates to <2,2>.') vertex.setX(2) vertex.setY(2)
xcoor=vertex.getX() ycoor=vertex.getY()
print('the top-right vertex is: <{},{}>.'.format(xcoor,ycoor))
#rectangle1=cs1graphics.Rectangle(w=ycoor*10,h=xcoor*10, centerPt=Point(0,0).midpoint(vertex*10)) #scene=Canvas() #scene.add(rectangle1) print('Prolem 2')
vertex = Point() print('setting vertex at top-right of rectangle coordinates to <2,2>.') vertex.setX(2) vertex.setY(2)
xcoor=vertex.getX() ycoor=vertex.getY()
print('the top-right vertex is: <{},{}>.'.format(xcoor,ycoor))
origin= Point(0,0)
print('The distance b/w the top right corner, {}, and the origin, {}, is {}'.format(vertex, origin, vertex.distance(origin)))
origin.normalize() vertex.normalize()
print('the normalized rectangle has vertecies on the bottom-right, {}, and the top-left, {}'.format(origin,vertex))
vertex = Point() print('setting vertex at top-right of rectangle coordinates to <2,2>.') vertex.setX(3) vertex.setY(2)
xcoor=vertex.getX() ycoor=vertex.getY()
print('the top-right vertex is: <{},{}>.'.format(xcoor,ycoor))
origin= Point(1,1)
origin.normalize() vertex.normalize()
print('the normalized rectangle has vertecies on the bottom-right, {}, and the top-left, {}'.format(origin,vertex))
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started