Question
Write a program that will perform fraction arithmetic. It should read in 2 fractions and an operator. After you add, subtract, multiply, or divide the
Write a program that will perform fraction arithmetic. It should read in 2 fractions and an operator. After you add, subtract, multiply, or divide the fractions, the answer must be reduced. That can be done by finding the GCD of the final numerator and denominator and then dividing both by the GCD.
You should have several functions. One to read the input (two numerators, two denominators, and the operator). You will need a GCD function and you should be able to reuse the code you wrote from last week. You will also need some functions for calculating the answer, such as one to add 2 fractions.
Sample Run #1: (the highlighted text is what the user types)
Evaluate? 1/2 + 1/4
Answer = 3/4
Press any key to continue . . .
Sample Run #2: (the highlighted text is what the user types)
Evaluate? 1/3 * 6/5
Answer = 2/5
Press any key to continue . . .
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