Create a class for working with mixed fractions only 3


Exam Program: Create a class for working with mixed fractions. Only 3 private data members are needed: the int whole number part of the fraction, the int numerator of the fraction, and the positive int denominator of the fraction. For example, the fraction 3 5/8 will have the three private data member values of 3, 5, and 8.

The following methods should be in your class:

a. A default constructor that should use default arguments in case no initializers are included in the main. The fraction needs to be stored in reduced form. Make sure the denominator is not set to 0 or a negative value.

b. Add two mixed fractions and store the sum in reduced form.

c. Subtract two mixed fractions and store the difference in reduced form.

d. Multiply two mixed fractions and store the product in reduced form.

e. Divide two mixed fractions and store the quotient in reduced form

f. Print a mixed fraction.

g. Change a fraction to its reciprocal. For example, the reciprocal of the fraction 3 5/8 is 8/29. The reciprocal of 4/19 is 4 3/4.

Your main should instantiate two mixed fractions and call each of the class methods. The two mixed fractions should be printed along with the sum, difference, product, quotient, and after being changed to its reciprocal. (Please do not overload the operators for this program.)

Request for Solution File

Ask an Expert for Answer!!
JAVA Programming: Create a class for working with mixed fractions only 3
Reference No:- TGS01709020

Expected delivery within 24 Hours