Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Algorithmic Trading Navigating The Digital Frontier

Authors: Alex Thompson

1st Edition

B0CHXR6CXX, 979-8223284987

More Books

Students also viewed these Databases questions

Question

What are the stages of project management? Write it in items.

Answered: 1 week ago

Question

why do consumers often fail to seek out higher yields on deposits ?

Answered: 1 week ago

Question

Is conflict always unhealthy? Why or why not? (Objective 4)

Answered: 1 week ago