Practical Two

Object-Oriented Programming

due : 4pm 7 March 1997


Part One

Modify Practical One so that the Stack is considered as a separate, self-contained object. Verify that the program still works perfectly.

Part Two

Using the Stack object created in Part One, write a function to reverse the contents of a stack, using only the previously-defined interface to the stack - use two stacks, pop the contents of one stack and push it onto another.

Part Three

Model arithmetic fractions as objects in C++. Include functions in your class to perform the basic arithmetic operations: addition, subtraction, multiplication, division, conversion to/from floating point.

Include any other functions that you feel useful. Test all functions by performing useful calculations.