Right, I used Euclid's algorithm to bring them down (by finding the greatest common denominator.) I understand the concept, but it was the code that was giving me trouble. The examples I had been looking at were comparing dates consisting of month, day, and year, which meant the boolean was checking that all were the same using &&. Is this the way I should check both denominator and numerator? It's the syntax. That's what always gets me....
I have written two classes, Fraction and useFraction. Fraction holds all of the methods required to process the data from useFraction, which consists of private ints that are turned into separate fractions. The source for the classes looks like this:
useFraction looks like this:
Code:
public class useFraction
{
public static void main(String[] args)
{
Leave a comment: