public class Point {
private static int count=0;
private int x=0, y=0;
private final int me;
public Point(int x, int y) {
this.x = x; this.y = y;
++count; me=count;
}
public int who() {return me;}
public void set(int x, int y) {
this.x = x; this.y = y;
}
public String toString() {
return "("+ who() + ")(" + x+"," + y + ")";
}
}
Program a subclass of class Point, the class
ColourPoint, which is as the Point, but it has an extra
feature, a double-valued colour field.
The ColourPoint-objects are constructed by:
Program only the needed elements to the class ColourPoint. You are not allowed to make changes in the class Point.
(17 pistettä)
(19 points)
When the program has created a "dictionary" of words, then it offers the translation servive: When the user writes a word in the original language, the program either gives the translation or informs that the asked word was unknown. Design and program self, how the program ends.
(17 pistettä)