Problem

You have been developing a Fraction class for Teacher’s Pet Software. Each Fraction contai...

You have been developing a Fraction class for Teacher’s Pet Software. Each Fraction contains a numerator, denominator, a whole-number portion, and access to several functions you have developed, including overloaded operators. Complete these tasks:

a. Create a Problem class for a teacher who wants to test her students on three Fraction problem types:

» Adding Fractions that both have a numerator of 1

» Adding Fractions that have the same denominator

» Adding Fractions whose sum is less than 1

The Problem class contains four Fraction objects and three bit fields, each representing one of the above conditions. Create a function that assigns the correct bit field values to an unsigned integer, based on the user’s selected Problem criteria. Pass this unsigned integer to the Problem constructor. The constructor then sets the appropriate bit fields and randomly assigns two Fraction values as operands in the Problem and computes their sum as the third Fraction value. The fourth Fraction value holds the user’s attempted answer to the addition problem. The Fractions used in the Problem must meet the user’s criteria. For example, a user might choose to use Fractions that both have a numerator of 1 and whose sum is less than 1, but that do not necessarily have the same denominator. In that case, a Problem such as 1/3 + 1/5 would be an acceptable Problem. You can make changes to the existing Fraction class as necessary. Write a main()function that prompts the user for Problem criteria, then instantiates at least five Problem objects and displays them. Accept the user’s answer for each Problem, and display a message indicating whether the user’s answer is correct. Save the file as Problem.cpp.


b. Write a main()function that declares an array of 10 Fraction objects. Write a recursive sort()function that places the Fraction objects in ascending order. Save the file as AscendingFractionSort.cpp.


c. Write a main()function that declares an array of 10 Fraction objects. Write a recursive sort()function that places the Fraction objects in descending order. Save the file as DescendingFractionSort.cpp.

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