Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a C++ program that, using the class frationType, performs operations on fr

ID: 3770505 • Letter: W

Question

Write a C++ program that, using the class frationType, performs operations on fractions.

Among other things, test the following: Suppose X, Y, and Z are objects of fractionType. If the input is 2/3 the statement:

cin >> x;

should store 2/3 in x. The statement:

cout << x + y << endl;

should output the value of x + y in fraction form. The statement:

z = x + y;

should store the sum of x and y in z in fraction form.

Make sure that you check for 0 denominators when creating and manipulating your fractions! If the constructor encounters a 0 denominator, set the entire fraction to 0 by setting the numerator to 0 and the denominator to 1.

.

You WILL need to reduce fractions to their simplest form.

.

The class should overload the arithmetic operators for fraction addition, subtraction, multiplication, and division.

Overload the Boolean operators for less than and greater than.

Overload the stream insertion and stream extraction operators as well.

Write a main program that thoroughly tests your fractions class.

Create at least 2 different fractions, and test each of your operators at least once.

Make sure you use meaningful variables names, and label your tests in your output.

Direct your output to the screen.

Explanation / Answer

program :   

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote