Share
Explore BrainMass

Java Program to check if Fractions are identical

Need some assistance modifying the attached code.

In the attached METHOD "equals", that takes as input another Fraction and returns true if the two fractions are identical and false if they are not, this method reduces the fraction to its lowest terms; that is, if one fraction is 20/60 and the other is 1/3, then the method returns true.
Embeded in the class is a TEST PROGRAM that allows a user to create a fraction.

REQUIREMENT:
1. Use loops in the "equals" method to reduce the fractions to their lowest terms.
2. The equals method modification should loop repeatedly until the user decides to quit. Inside the body of the loop, the program should allow the user to enter a target fraction into an anonymous object and learn whether the fractions are identical.

Attachments

Solution Preview

Hi
I have created the program with explanations as comments.

First, compile the ...

Solution Summary

The solution program
1. uses loops in the "equals" method to reduce the fractions to their lowest terms.
2. The loop repeatedly works until the user decides to quit. Inside the body of the loop, the program allows the user to enter a target fraction into an anonymous object and outputs if the fractions are identical.

$2.19