August
1997 QUESTION 4 Total Marks: 20 Marks |
Click here to access other
questions
SUGGESTED SOLUTIONS |
| 4. | (a) List the six steps involved in the object-oriented design process. | [6] | |
| Identify the problem and identify the real world objects. | |||
| Identify the methods or activities that define the objects. | |||
| Identify and establish object visibility. | |||
| Establish the interfaces. | |||
| Establish the object classes. | |||
| Implement or reiterate the design. | |||
| one mark for each step | |||
| [6 marks] | |||
| (b) A program is required to determine the area and perimeter of a variety of geometric figures. Each figure is encapsulated with its own attributes to create a distinct class. | [7] | ||
| Describe the attributes and methods for a circle class that is to be constructed first. You are required to list only the attributes and methods, no C++ code is required.Provide explanations if unsure. | |||
| Attributes for the Circle class: | |||
| radius | |||
| area | |||
| perimeter (or circumference) | |||
| Methods for the circle class: | |||
| get_known_attributes (reads in radius) | |||
| compute_area | |||
| compute_perimeter | |||
| display_attributes | |||
| Marking scheme: | |||
| As above --- 7 marks | |||
| Area and Perimeter , with correct methods --- 5 or 6 marks | |||
| Correct intention but incorrect methods ---3 or 4 marks | |||
| Some correct ideas --- 1 or 2 marks | |||
| [7 marks] | |||
| (c) The design of a rectangle class follows along the same lines as the circle class. | [7] | ||
| Define the rectangle class in C++. | |||
![]() |
|||
| deduct one mark for each error or omission, minimum zero. | |||
| [7 marks] | |||