Project03
Home ] Up ]

 

CSIS 250 Summer 2000 Assignment #3

Date Assigned:              July 20, 2000

Date Due:                        July 25, 2000 at 10:00 AM

Overload the following operators to the CRational class for performing arithmetic and comparison operations among fractions.  More information about fractions can be obtained at the following Web site.

http://www.sosmath.com/algebra/fraction/frac3/frac3.html

Write a main driver program and several test functions (one for each operator function member).

Overload the following operators:

a)               Addition operator (+) for two CRational numbers.  The result should be stored in reduced form.

b)              Subtraction operator (-) for two CRational numbers.  The result should be stored in reduced form.

c)               Multiplication operator (*) for two CRational numbers.  The result should be stored in reduced form.

d)              Division operator (/) for two CRational numbers.  The result should be stored in reduced form.

e)               Insertion operator (<<)  for printing CRational numbers in the form a/b where a is the numerator and b is the denominator

f)                  Extraction operator (>>) for inputting CRational numbers.

g)                Equality operator (==) for comparing two rational numbers.

h)              Inequality operator (!=) for comparing two rational numbers.

i)                   Less-than operator (<) for comparing two rational numbers.

j)                  Greater-than operator (>) for comparing two rational numbers.

k)               Less-than-or-equal-to operator (<=) for comparing two rational numbers.

l)                  Greater-than-or-equal-to operator (>=) for comparing two rational numbers.


Submit the following:

  1. Properly commented printed source code with algorithms
  2. Properly labeled printed output from test runs
  3. Self-evaluation sheet

 


Self-Evaluation Sheet Project #3

Component

Max Score

Your Score

Addition operator (+) for two CRational numbers.  The result should be stored in reduced form.

4

 

Subtraction operator (-) for two CRational numbers.  The result should be stored in reduced form.

4

 

Multiplication operator (*) for two CRational numbers.  The result should be stored in reduced form.

4

 

Division operator (/) for two CRational numbers.  The result should be stored in reduced form.

4

 

Insertion operator (<<) for printing CRational numbers in the form a/b where a is the numerator and b is the denominator

4

 

Extraction operator (>>) for inputting CRational numbers.

4

 

Equality operator (==) for comparing two rational numbers.

4

 

Inequality operator (!=) for comparing two rational numbers.

4

 

Less-than operator (<) for comparing two rational numbers.

4

 

Greater-than operator (>) for comparing two rational numbers.

4

 

Less-than-or-equal-to operator (<=) for comparing two rational numbers.

4

 

Greater-than-or-equal-to operator (>=) for comparing two rational numbers.

4

 

Total points (1 point for function source code, 1 point for algorithm, 1 point for test function, and 1 point for test run make 4 points for each function).  A function should work all the time in order to get any credit for it.

48