Problem

You developed a Fraction structure for Teacher’s Pet Software. The structure contains thre...

You developed a Fraction structure for Teacher’s Pet Software. The structure contains three public data fields for whole number, 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 for two of the Fractions. Add statements to the main()function to do the following:

» Do not allow the user to enter a 0 denominator for any Fraction; continue to prompt the user until an acceptable denominator is entered.

» Reduce each Fraction to proper fraction form and display it. For example, the following table shows some user entries and the output you should display.

» Prompt the user to enter an arithmetic operation: + or *. Calculate the third Fraction to be the result of applying the requested operation to the two entered Fractions. Display the result as a whole number, if any, and the fractional part, if any. Reduce the result to proper form. For example, adding 1/4 and 1/4 results in 1/2, adding 3/4 and 3/4 results in 1 1/2, subtracting 1/5 from 3/1 results in 2 4/5, and multiplying 1/3 by 6/1 results in 2.

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