Question: // driver for project 5 #include using namespace std ; #include Frac2.h int main () { Fraction c( 7 , 3 ) , d( 3

// driver for project 5

#include

using namespace std;

#include "Frac2.h"

int main() {

Fraction c(7, 3), d(3, 9), x;

// c.printFraction();

cout c;

cout " + ";

// d.printFraction();

cout d;

cout " = ";

x = c + d;

// x.printFraction();

cout x;

cout ' ';

// c.printFraction();

cout c;

cout " - ";

// d.printFraction();

cout d;

cout " = ";

x = c - d;

// x.printFraction();

cout x;

cout ' ';

// c.printFraction();

cout c;

cout " * ";

// d.printFraction();

cout d;

cout " = ";

x = c * d;

// x.printFraction();

cout x;

cout ' ';

// c.printFraction();

cout c;

cout " / ";

// d.printFraction();

cout d;

cout " = ";

x = c / d;

// x.printFraction();

cout x;

cout ' ';

// c.printFraction();

cout c;

cout " is: ";

cout ((c > d) ? " > " : " );

// d.printFraction();

cout d;

cout " according to the overloaded > operator ";

cout ((c d) ? " : " >= ");

// d.printFraction();

cout d;

cout " according to the overloaded ";

/* uncomment this line for improved version

// Optional: 2 Bonus Points

// c.printFraction();

cout

cout

// d.printFraction();

cout

cout

cout

cout

cout

cout

cout

cout

x = c + c / d - d * c; // cascading use of operators

// x.printFraction();

cout

cout

*/ // uncomment this line for improve version

#ifdef _WIN32 // _WIN32 is used by visual C++

#if (_MSC_VER

system("pause");

#endif

#endif

return 0;

}

 // driver for project 5 #include using namespace std; #include "Frac2.h"
int main() { Fraction c(7, 3), d(3, 9), x; // c.printFraction(); cout

CMPSC122 Lab Proj 5 - Overloading Operators, Stream, and String Classes Project 5. Building a class for Fraction ADT Phase 2 ( 20 points. submit your two source files named Frac2.cpp and Frac 2.h online only before the due time next week) This assignment is the continuation of project 4 , with the modification and improvement of the following modifications: - In Frac.h, replace the methods of addition (const Fraction \&), subtraction(const Fraction\&), multiply( const Fraction \&), divide(const Fraction \&), void printFraction() by overloading operators +,,,1, respectively. - Add overloading operators > and 1/3 according to the overloaded > operator >=1/3 according to the overloaded

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 Databases Questions!