Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ NEED HELP #ifndef FRACTION_H #define FRACTION_H #include #include #include using namespace std; class Fraction { private: long *numerator ; long *denominator; public: long getNumerator()

C++ NEED HELP image text in transcribed #ifndef FRACTION_H #define FRACTION_H #include  #include  #include  using namespace std; class Fraction { private: long *numerator ; long *denominator; public: long getNumerator() ; long getDenominator() ; void reduce() ; long gcd(long,long) ; // constructors Fraction() ; // default c'tor Fraction (long n) ; // create a fraction of n/1 Fraction(long n, long m) ; // Fraction n/m Fraction(Fraction & other) ; // copy c'tor ~Fraction() ; // destructor Fraction & operator=(Fraction & rhs) ; // overload assignment operator Fraction & operator+(Fraction &rhs) ; Fraction & operator-(Fraction &rhs) ; // overload binary operator - Fraction & operator-() ; // overload unary operator - (negative) Fraction & operator *(Fraction &rhs) ; Fraction & operator/(Fraction & rhs) ; Fraction & operator++() ;// overload prefix ++ Fraction & operator++(int) ; // overload postfix ++ Fraction & operator--() ;// overload prefix -- Fraction & operator--(int) ; // overload postfix -- // overload relational operators bool operator >(Fraction & rhs) ; // return true if *this > rhs , false elsewise bool operator == (Fraction & rhs) ; bool operator > (istream & in , Fraction & rhs) ; friend ostream & operator   1. Complete the implementation of the given Fraction class Notes You are not allowed to make any change to the given Fraction class. r and* if the Fraction is negative, the negative sign always goes to *numerator, *denominator always greater than or equal to l . . for the output operator if *denomiator is equal to 1, the denominator will not be displayed. (i.e. 2 instead of 2/1) if the Fraction is negative, make sure that negative sign always goes with numerator (i.e. -2/3 instead of 2/-3) use the given driver to test your code. You must put the Fraction class and its implementation in a file named Fractionh file which is separated from the main

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

SQL Server T-SQL Recipes

Authors: David Dye, Jason Brimhall

4th Edition

1484200616, 9781484200612

More Books

Students also viewed these Databases questions