Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

i need this at c++ B). Create a Math Problem class that contains four Fraction objects: the first Fraction operand in a problem, the second

i need this at c++ image text in transcribed
B). Create a Math Problem class that contains four Fraction objects: the first Fraction operand in a problem, the second Fraction operand in a problem, the user's Fraction answer to a problem, and the correct Fraction answer to a problem. The Math Problem class also contains a character field that stores an operator (for now, assume the operator will be either + or ") and contains an integer or bool field named isAnswerCorrect, indicating whether the user correctly answered the problem. For example, a MathProblem object containing 1/2, 1/4, and + for the operands and operators, 3/4 for the correct answer, and 3/8 for the user's answer would contain a 0 or false in the isAnswerCorrect field because the correct answer and user's answer do not match. Set the isAnswerCorrect field to true if the user's answer is equivalent to the correct answer, for example, if 3/4 is the correct answer, then 3/4, 6/8, and 9/12 are all correct. Include a function named setProblem(that sets a MathProblem's values with arguments that include two Fraction operands and an operation. This function calculates and stores the correct answer, assigns 0 to the user's answer, and sets isAnswerCorrect to 0 or false. Include a displayProblem function that displays the math problem as a question, and an askUserForAnswer function that accepts the user's answer from the keyboard and assigns an appropriate value to isAnswerCorrect Include any other MathProblem functions you feel are useful and appropriate Write a main() function that declares five MathProblem objects you can use to test a student's fraction arithmetic skills. Assign values to the Math Problems. Display the problems and accept the answers. When the five problems are completed, display each of the problems, along with the student's answer the correct answer, and a message indicating whether the student is right or wrong. Finally, show the student a score indicating the percentage of problems answered correctly

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Seven NoSQL Databases In A Week Get Up And Running With The Fundamentals And Functionalities Of Seven Of The Most Popular NoSQL Databases

Authors: Aaron Ploetz ,Devram Kandhare ,Sudarshan Kadambi ,Xun Wu

1st Edition

1787288862, 978-1787288867

More Books

Students also viewed these Databases questions

Question

1.. Why is it important to develop service standards and targets?

Answered: 1 week ago

Question

Describe the types of power that effective leaders employ

Answered: 1 week ago

Question

Describe how leadership styles should be adapted to the situation

Answered: 1 week ago