1 Introduction Consider the following C++ class declaration: class Fraction { pr
ID: 3611587 • Letter: 1
Question
1 IntroductionConsider the following C++ class declaration:
class Fraction
{ private :
int num; // the fraction’s numerator .
int den ; // the fraction’s denominator .
public :
void pr int ( ) ; // prints num/den .
void read ( ) ; // enter num/den from standard input .
Fraction ( ) ; // default ctor , ”empty” fraction .
Fraction ( int n , int d ) ; //a function to build a
// fraction n/d .
};
2 Problem
Create a class Fraction using the above declaration. Store thedeclaration in a file
called fraction.h. Create an implementation file calledfraction.cc. Implement all the
member functions listed above and store your definitions infractions.cc. In addition, add
(design and implement) to class Fraction member functions thatperform the following
operations on Fractions:
1. Convert a Fraction to a decimal.
2. Convert an integer to a Fraction.
3. Add two Fractions together.
1