Maybe the 2nd lesson I suggested was a little too ambitious. So I decided put the following task before that:
class Point{
int x, y;
Point(){...} // default constructor
Point(int x, int y){...} // another constructor
Point(Point p){...} // copy constructor
float getDistance(Point p){...}
void draw(Graphics g){..} //draw a cross, or a circle?
}
class Line{
Point p1, p2;
Line(int x1, int y1, int x2, int y2){...}
float getLength(){...}
void draw(Graphics g) {...}
}
No comments:
Post a Comment