Calling the reduce method from my Fraction class and apply to to my FractionMath
<p>So here is my Fraction class. The math works but I want to fraction to be reduced. Note: This is in Eclipse SDK Juno.</p>

<pre><code>public class Fraction {
private int n, d;
public Fraction(int num, int denum){
    n = num;
    d = denum;
}

public int getNumerator(){
return n;
}
public void setNumerator(int num){
    n = num;
}
public int getDenumerator(){
    return d;
}
public void setDenumerator(int denum){
    d = denum;
}
**public void reduce(){
    int gcf = 1, smaller;
    if (n &lt; d){
        smaller = n;
    }
    else{
        smaller = d;
    }
    for (int i = 1;i &lt;= smaller; i++){
        if(n % i == 0 &amp;&amp; d % i ==0){
            gcf = i;
        }
    }
    n = n/gcf;
    d = d/gcf;
    System.out.print(n + "/" + d);
}**
}
</code></pre>

<p>In bold is what I what to output in my FractionMath shown below. I don't know how to apply the reduce method in this class. I tried method.Fraction() but that gave me an error...help?</p>

<pre><code>import java.util.*;

public class FractionMath {
public static void main(String[] args){
    Fraction f1, f2;
    Fraction ans = new Fraction(0,0);
    Scanner sc = new Scanner(System.in);
    System.out.print("Enter the numerator; then denumerator:\n");
    f1 = new Fraction(sc.nextInt(), sc.nextInt());
    System.out.print("Enter another numerator; and denumerator:\n");
    f2 = new Fraction(sc.nextInt(), sc.nextInt());
    System.out.print("Add (1)\nSubtract (2)\nMultiply (3)\nDivide (4)\n");
    int choice = sc.nextInt();
    if (choice == 1){
         if (f1.getDenumerator() == f2.getDenumerator()){
             ans.setNumerator(f1.getNumerator() + f2.getNumerator());
             ans.setDenumerator(f1.getDenumerator());
         }
         else{
             ans.setNumerator(f1.getNumerator() * f2.getDenumerator() + f2.getNumerator() * f1.getDenumerator());
             ans.setDenumerator(f1.getDenumerator() * f2.getDenumerator());
         }
    }
    else if (choice == 2){
        if (f1.getDenumerator() == f2.getDenumerator()){
             ans.setNumerator(f1.getNumerator() - f2.getNumerator());
             ans.setDenumerator(f1.getDenumerator());
         }
         else{
             ans.setNumerator(f1.getNumerator() * f2.getDenumerator() - f2.getNumerator() * f1.getDenumerator());
             ans.setDenumerator(f1.getDenumerator() * f2.getDenumerator());
         }
    }
    else if (choice == 3){
        ans.setNumerator(f1.getNumerator() * f2.getNumerator());
        ans.setDenumerator(f1.getDenumerator() * f2.getDenumerator());
    }
    else if (choice == 4){
        ans.setNumerator(f1.getNumerator() * f2.getDenumerator());
        ans.setDenumerator(f1.getDenumerator() * f2.getNumerator());
    }
}
}
</code></pre>
