18.10.2014 Views

Object-oriented Software in Ada 95

Object-oriented Software in Ada 95

Object-oriented Software in Ada 95

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

190 Child libraries<br />

13.7 Exercises<br />

Construct the follow<strong>in</strong>g class which uses exceptions:<br />

• Average<br />

This class has the follow<strong>in</strong>g methods:<br />

Method<br />

Add<br />

Average<br />

Reset<br />

Responsibility<br />

Add a new data value.<br />

Deliver the average of the data values held.<br />

Reset the object to its <strong>in</strong>itial state.<br />

The exception No_Data is raised when an attempt is made to calculate the average of zero numbers.<br />

© M A Smith - May not be reproduced without permission

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!