Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Need help with this C++ problem please Given the header file fraction.h, write fraction.cpp and testFraction.cpp to test your code. testFraction.cpp should call each function:
Need help with this C++ problem please
Given the header file fraction.h, write fraction.cpp and testFraction.cpp to test your code. testFraction.cpp should call each function: display(), Multiply(), operator*(), getTop() and getBottom(). The output when you run the code should be as follows: The first fraction is 42 The second fraction is 34 The third fraction is 3/8 //if it is the fraction that is created when Multiply() or operator*() is called. Hint: the definition of the display() function should show the previous output. The first fraction is created when the constructor fraction() is called. The second fraction is created when the constructor fraction(int) is called. The third fraction is created when the constructor fraction(int, int) is called. //fraction.h class fraction{ public: fraction(); fraction(int); fraction(int, int); void display(); fraction Multiply (const fraction &); fraction operator* (const fraction &); int getTop({return top;} int getBottom(){return bottom;} private: int top; int bottom; }Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started