Well I need help one of the two questions which are similar to the topic I'm asking. The first question that I solve was "Taller method should return true if the tree on which the method is invoked has a greater height than the tree passes as a paramter".
public static boolean Taller(STree B)
{
if(this.Height() > B.Height())
return true;
else
return false;
}
which is correct. The next question is what I'm trying to solve which is "The Positive method should return
true if the fraction passed as a parameter is positive, that is, if the numerator and denominator have the same
sign; otherwise it should return false". Here's my attempt, so any feedback is appreciated.
public class LFraction implements HasPos<IFraction>
{
public static boolean Positive(LFraction T)
{
if((T.Numerator && >= 0) * (T. Denominator && >= 0) > 0 || (T.Numerator && <= 0) *
(T.Denominator && <= 0) < 0)
return true;
else
return false;