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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!