Purchase Solution

Java Program to check if Fractions are identical

Not what you're looking for?

Ask Custom Question

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.

Purchase this Solution

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.

Solution Preview

Hi
I have created the program with explanations as comments.

First, compile the ...

Purchase this Solution


Free BrainMass Quizzes
Basic UNIX commands

Use this quiz to check your knowledge of a few common UNIX commands. The quiz covers some of the most essential UNIX commands and their basic usage. If you can pass this quiz then you are clearly on your way to becoming an effective UNIX command line user.

Java loops

This quiz checks your knowledge of for and while loops in Java. For and while loops are essential building blocks for all Java programs. Having a solid understanding of these constructs is critical for success in programming Java.

Word 2010: Tables

Have you never worked with Tables in Word 2010? Maybe it has been a while since you have used a Table in Word and you need to brush up on your skills. Several keywords and popular options are discussed as you go through this quiz.

C# variables and classes

This quiz contains questions about C# classes and variables.

Inserting and deleting in a linked list

This quiz tests your understanding of how to insert and delete elements in a linked list. Understanding of the use of linked lists, and the related performance aspects, is an important fundamental skill of computer science data structures.