Shinichi
New Coder
Hey I wanted to ask if you could help me with my code.
I am supposed to write a class point which shows a point in the plane. A Treeset shouldn't contain more point objects with the same cordinates. Also in TreeSets the point objects should be sorted by their distance to the coordinate origin. ( Points with the some distance but different cordinates (z.B. (1|1), (-1|-1)) shouldn't be interpreted as a duplicate). But I don't know how to handle the cordinates in a TreeSet so it would be nice if you could help me but i don't have much until now.
I am supposed to write a class point which shows a point in the plane. A Treeset shouldn't contain more point objects with the same cordinates. Also in TreeSets the point objects should be sorted by their distance to the coordinate origin. ( Points with the some distance but different cordinates (z.B. (1|1), (-1|-1)) shouldn't be interpreted as a duplicate). But I don't know how to handle the cordinates in a TreeSet so it would be nice if you could help me but i don't have much until now.
Java:
/*
hint for the exercise: Math.sqrt()
*/
public static int createAPoint() {
TreeSet<Integer> point = new TreeSet<>();
return 0;
}