Problem

In you developed a Fraction structure for Teacher’s Pet Software. The structure contains t...

In you developed a Fraction structure for Teacher’s Pet Software. The structure contains two public data fields for numerator and denominator. Using the same structure, write a main()function in which you create three Fraction objects. Prompt the user for values for each field of two of the Fractions. Add statements to the main()function to do the following:

» Display the floating-point equivalent of each Fraction object. For example, the floatingpoint equivalent of 1/4 is 0.25.

» Calculate the third Fraction to be the sum of the two entered Fractions. To sum fractions, you must find a common denominator. You can do this by multiplying each operand Fraction’s numerator and denominator by the denominator of the other Fraction, using the common denominators, and adding the numerators. For example, to create a Fraction that is the sum of 2/5 plus 1/6, you do the following:

1. Multiply the numerator and denominator of 2/5 by the denominator of the second Fraction, 6, giving 12/30.

2. Multiply the numerator and denominator of 1/6 by the denominator of the first Fraction, 5, giving 5/30.

3. Add the numerators and use the common denominator, giving 17/30.

Display the result. You do not need to reduce an improper Fraction result. For example, when you add 1/2 and 1/4, the result can be displayed as 6/8 instead of being reduced to 3/4.

Step-by-Step Solution

Request Professional Solution

Request Solution!

We need at least 10 more requests to produce the solution.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the solution will be notified once they are available.
Add your Solution
Textbook Solutions and Answers Search
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT