Question
In earlier chapters, you developed a Fraction structure for Teachers Pet Software. The structure contains three public data fields for whole number, numerator, and denominator.
In earlier chapters, you developed a Fraction structure for Teachers 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.
Any coding assignments will have to be submitted in .cpp format and a Word document with the code copy/pasted and screenshots of the output.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started