Question: C + + Create a class called Fraction for performing arithmetic with fractions. Use integer variables to represent the private data of the class the

C++
Create a class called Fraction for performing arithmetic with fractions. Use integer variables to represent the private data of the classthe numerator and the denominator. Provide a constructor function that enables an object of this class to be initialized when it is declared. The constructor should contain default values in case no initializers are provided. Provide public member functions for each of the following:
a) Addition of two Fraction numbers. See the solution as an example below.
b) Subtraction of two Fraction numbers.
c) Multiplication of two Fraction numbers.
d) Division of two Fraction numbers.
e) Printing Fraction numbers in the form a/b where a is the numerator and b is the denominator.
f) Printing Fraction numbers in double floating-point format.

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