Waiting for answer This question has not been answered yet. You can hire a professional tutor to get the answer.

QUESTION

Please solve this question in C++ Program Description: Design and implement an immutable Fraction Class described in the Fraction case study.

Please solve this question in C++

Program Description:

Design and implement an immutable Fraction Class described in the Fraction case study. Your

class must have the following methods to emulate arithmetic, relational, and I/O operations on

Fractions.

1. Arithmetic operators: + - * /

2. Relational operators: < <= > >=

3. Equality operators: == !=

4. Stream Extraction: >> (i.e. 3/7 form)

5. Stream Insertion: << (i.e. 3/7 form)

6. Method to reduce fraction

Specific Requirements:

• Your main testing program may only have two variables: start and userFraction which

are both of type Fraction.

• start should contain values set by you that are passed into the constructor.

• userFraction should start out calling the default constructor and then have its values set

through the overloaded >> operator.

• There are to be no get/set methods for the Fraction class. Having get/set methods in

your class will cause you to lose significant points.

• Note that the testing program displays the words true or false for the relational

operator testing.

Be sure to test your program with several different fractions, but for your output you report to

me, use the exact test values from the example output. Demonstrate all methods

implemented.

Helpful notes:

• You should create a .h file and two different .cpp files for this lab.

• You will not need to create a destructor.

• You may consider making a private helper function or two for simplifying your fraction.

Grading Rubric:

1. Correctness (meets specification) 5 points

2. Design (well-constructed solution) 2

3. Validation & Verification (Testing) 4

4. Style (readable for your client - me) 1

Example output:

*****Fraction Demonstration*****

We will start with the fraction 3/5

Enter a new fraction:

Numerator: 6

Denominator: 8

Your simplified fraction is: 3/4

********************************

Demonstrating overloaded math operators: -, +, *, /

This will show negation of 3/5 and then our two fractions

3/5 and 3/4 added, multiplied, and divided.

-: -3/5

+: 27/20

*: 9/20

/: 4/5

********************************

Demonstrating overloaded relational operators: <, <=, >, >=, == !=

by comparing 3/5 with 3/4.

<: true

<=: true

>: false

>=: false

==: false

!=: true

********************************

Show more
LEARN MORE EFFECTIVELY AND GET BETTER GRADES!
Ask a Question