Solutions: Exercise 4c

Designing Classes

Remember: The solutions below are only suggested solutions.

c) The attributes and operations of the classes are:

Class Line
Attributes: startPoint, endPoint, colour
Operations: move(newStartPoint), draw(colour), remove

Class Circle
Attributes: centerPoint, radius, colour
Operations: move(newCenterPoint), draw(colour), remove

Class Rectangle
Attributes: topLeftPoint, bottomRightPoint, colour
Operations: move(newTopLeftPoint), draw(colour), remove

Class Point
Attributes: xpos, ypos
Operations: setxpos. setypos, getxpos, getypos


previous | next | start | contents | dictionary | help | evaluation

© Ericsson Telecom AB, 1995, Stockholm, Sweden