Challenge: Make the Unit Tests Pass
Here is a coding challenge to overload operators for the Fraction struct.
We'll cover the following
Problem statement
Define a Fraction
type that stores as members numerator and denominator of type long
. Such a type may be useful because it does not lose value like float
, double
, and real
due to their precisions. For example, although the result of multiplying a double
value of 1.0/3 by 3 is not 1.0, multiplying a Fraction
object that represents the fraction 1/3 by 3 would be 1:
Get hands-on with 1400+ tech skills courses.