Question: Delete your set() function. Add two constructors, a default constructor that assigns the value 0 to the fraction, and a constructor that takes two parameters.
Delete your set() function. Add two constructors, a default constructor that assigns the value 0 to the fraction, and a constructor that takes two parameters. The first parameter will represent the initial numerator of the fraction, and the second parameter will represent the initial denominator of the fraction. Since fractions cannot have denominators of 0, the default constructor should assign 0 to the numerator and 1 to the denominator.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
