Question
Question 2 Fractions You are designing a quiz game to help elementary school students with fraction calculations. Design and Program your own Fraction Class (You
Question 2 Fractions You are designing a quiz game to help elementary school students with fraction calculations. Design and Program your own Fraction Class (You cannot use the one that is built into python) Fields Numerator, Denominator Constructor Accept a value for the numerator and the denominator Methods Reduce o Reduce a fraction to lowest terms Add, Subtract, Multiply, Divide two fractions o Should be of the form f3 = f1.add(f2) or f3 = f1.mulitply(f2) when called from main program o So accept a fraction as an argument and return a new fraction Equals o Checks if 2 fractions are equivalent o So accept a second fraction as an argument to the function o Should be of the form f1.equals(f2) when called Override __str__ o Returns a string n/d to represent the fraction The questions will be generated randomly. Fractions are always improper (no mixed) in the form n/d Numerators should be between 1 and 15 Denominators should be between 2 and 15 Dont allow whole number results The generated fractions in the questions should always be in lowest terms There should be a random mixture between addition, subtraction, multiplication, and division questions. 2 Fractions should occur in each question. Display a question to the player and then ask for the answer in lowest terms. Indicate if they are correct or not. Accept correct answers not in lowest terms, but Your program should always display the correct answer in lowest terms so the player can learn from their mistakes. The game continues until the player chooses to stop
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