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 function template named problem()that accepts three arguments. The first and third arguments are generic values representing values a student will use as an arithmetic drill problem. The middle argument is a character representing a mathematical operation such as ‘+’ or ‘-’. The problem()function displays the first argument, the operation sign, and the second argument on the screen, and allows the student to input an answer. The function returns the student answer to the calling program; the answer is the same data type as the first and third function arguments.


b. Create another function template named solution()that accepts three arguments. The first and third arguments are generic values representing values, and the middle argument is a character representing a mathematical operation such as ‘+’ or ‘-’. The solution()function returns the correct answer to the problem.


c. Create a third function template named congrats()that accepts a correct answer. It displays the correct answer and a congratulatory message when a student enters the correct answer to a problem. Display the answer and the message 10 times on the screen, cascading to the right. For example, if the correct answer is 27, then the output is:

27 Congratulations! Correct Answer!  27 Congratulations! Correct Answer!   27 Congratulations! Correct Answer!

. . . and so on, until it appears 10 times.

The function will be used whether the problem needs an integer, double, character, or Fraction answer.


d. Write a main()function that presents a student with at least three integer or double arithmetic problems. Display the problems using the problem()function, and compute the correct answer with the solution()function. If a solution is incorrect, display a brief message, but pass any correct student solutions to the congrats() function.


e. Add three multiple-choice problems to the student drill. The answers are characters—‘a’, ‘b’, or ‘c’. Display the questions and answer choices with cout statements. If a solution is incorrect, display a brief message, but pass any correct student solutions to the congrats()function.


f. Add three true/false questions to the student drill. The answers are characters—‘t’ or ‘f ’. Display the questions and answer choices with cout statements. If a solution is incorrect, display a brief message, but pass any correct student solutions to the congrats() function.


g. Add three Fraction problems to the student drill. Display the problems using the problem()function, and compute the correct answer with the solution()function. If a solution is incorrect, display a brief message, but pass any correct student solutions to the congrats()function.

Save the final program as FractionTemplateFunctions.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