Catch-Up Day, Taken
Tom Kelliher, CS23
Mar. 1, 1996
A rational number is the ratio of two integers
Design a rational class with the following operations:
All rationals should be stored in reduced form, using a private method to
reduce to lowest terms.
- Add --- Increment this rational by a rational or an integer.
Use function overloading.
- Mult --- Similar to add.
- Set --- Set this rational to a new value. Takes one or two
parameters (set to integer value, set to rational value, respectively).
Use default arguments.
- Display --- Display the value of this rational number.
The constructor should take zero, one, or two arguments (initialize to 0,
an integer, or a rational, respectively). Again, use default arguments.
Write a small driver program to use the rational class. The source and
header files will be provided for you.
Thomas P. Kelliher
Thu Feb 29 16:11:00 EST 1996