1
Good evening, I need to do a point TAD implementation, I’m managing to do in Python, but the problem is that it should be implemented in Java and I have no idea how to start.
import math
class Ponto(object):
def __init__(self, x=0, y=0):
self.x=x
self.y=y
def igual(self, ponto):
return self.x == ponto.x and self.y == ponto.y
def texto(self):
return '('+str(self.x)+', '+str(self.y)+')'
def distancia(self, ponto):
d1=self.x-ponto.x
d2=self.y-ponto.y
return math.sqrt(d1*d1+d2*d2)
def translada(self, dx, dy):
self.x=self.x+dx
self.y=self.y+dy
What do you know about Java? If it’s little, start by studying the language documentation.
– Woss
You can start by that question
– Pagotti