Question: Write a program called WorkWithFractions which contains code that will: Use objects which are instances of the Fraction class (next page) Provide methods that Multiply,

Write a program called WorkWithFractions which contains code that will:

Use objects which are instances of the Fraction class (next page)

Provide methods that Multiply, Divide, Add and Subtract these fractions (not their oating point representations)

Allow the user to enter two fractions, convert each to lowest terms and report the results of multiplying, dividing, adding and subtracting them

The class that represents a fraction should be called Fraction

A JavaBean that represents the numerator and denominator as two separate attributes You are required to store fractions in lowest terms.

e.g. if I try to create a fraction with a numerator 18 and a denominator 24, you should fgure out that this is the fraction 3/4 and store it in that fashion (with 3 as numerator and 4 as denominator).

Fractions may also be negative, make sure to take this into account in some way.

-- Example input (preceded by a >) and output of your program:

Enter a numerator > 60 Enter a denominator > 105 
You entered the fraction 4 / 7 

Enter a numerator >2 Enter a denominator >3

You entered the fraction 2 / 3 
(4 / 7) * (2 / 3) = (8 / 21) (4 / 7) / (2 / 3) = (6 / 7) (4 / 7) + (2 / 3) = (26 / 21) (4 / 7) - (2 / 3) = (-2 / 21) 

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!