I believe I am doing this right, but I am having issues with my ImproperFraction method in my fraction class outputting properly. It is just to output wither or not the fraction is improper, doesn't have to be anything special.
public boolean ImproperFraction(Fraction otherObject1){
if( numerator > denominator) {
System.out.println("Your fraction is improper and cannot be reduced");
Fraction otherFraction = (Fraction)otherObject1;
return ((numerator == otherFraction.numerator) &&
(denominator == otherFraction.denominator));
}
else if(numerator <= denominator) {
System.out.println("Your fraction is proper and has been reduced");
return false;
}
else {
return false;
}
}
In the main class:
System.out.println(ImproperFraction);
The only thing that it is doing is returning false, even though the fraction I put in for it is improper. Thanks for any help!
Well, now that you've shown your entire code - it seems that you're not actually calling the ImproperFraction
method anywhere.
You've got a static boolean variable called ImproperFraction
which you never actually set, so it's always false. And in the line System.out.println(ImproperFraction)
, you're printing that variable. But you never call the ImproperFraction
method, so the code that you've posted in the actual question (not the pastebin) never runs.