25 Jan This assignment is an exercise in creating a complete class definition. A standard way to do that is to use a math data type. Here we define a Rational Number data type in a class called “Rational”
Introduction
The Object Oriented software model is designed to create a new data type by using the
Class structure. Therefore the various operations which define a data type, such as the
common operators, assignment, etc., have a software architecture available to create
those operations and data types.
Assignment Description
This assignment is an exercise in creating a complete class definition. A standard way to
do that is to use a math data type. Here we define a Rational Number data type in a class
called “Rational”. The distinctive feature of this type is the data is kept as numerator and
denominator throughout all operations; there is no floating point representation used. The
standard math operations, addition, subtraction, etc., are implemented, including the
iostream overload. The student will not only come to understand what is required for a
complete representation of such a type, but also learn about the internal mechanics of its
C++ implementation.
The student will be given the Rational.h header file. The student will complete the class
definition by creating the Rational.cpp file.
Program Requirements
1. The student will create the Rational.cpp implementation for a class called Rational.
The interface for the Rational class will be provided with all applicable method
declarations.
2. The student will create the implementation for all methods defined in the header by
creating the file named Rational.cpp. There may be additional helper methods
defined as needed by the implementation.
3. The student will create a test driver to test each of the methods defined in the class.
The test driver file will be called TestRational.cpp.
4. The student will submit the source file for the test driver, TestRational.cpp, and the
Rational.cpp file.