Mixed Fraction Classes: Exercise
Explore how to enhance the MixedFraction class by implementing subtract, multiply, and division functions. This lesson guides you step-by-step through coding essential fraction operations, reinforcing your understanding of object-oriented programming concepts in C++.
In this lesson, we’ll implement the code for the missing three fraction functions: subtraction, multiplication, and division.
Your implementation
Following the instructions, write your own implementation here:
Exercise: Complete the MixedFraction class
The first exercise is to add three prototypes to the MixedFraction.h file inside the MixedFraction class declaration.
Exercise 2: Implement the multiply() function
Write the multiply() function (in MixedFraction.cpp) as a member function in the MixedFraction class and uncomment the lines in main() where multiply() is called.
Exercise 3: Implement the division() function
Write the division() function (in MixedFraction.cpp) as a member function in the MixedFraction class and uncomment the lines in main() where division() is called.
If you have trouble getting to the solution, you can click the “Show Solution” button to see how to implement it.