Complete the methods getSmaller, getLarger, and getOrderedPair in the following class of pairs of integers:
/** Represents pairs of integers. */
public class Pair
{
private int one;
private int two;
public Pair(int oneNumber, int anotherNumber)
one = oneNumber;
two = anotherNumber;
} // end constructor
/** Returns the smaller integer in this pair. */
public int getSmaller()
. . .
} // end getSmaller
/** Returns the larger integer in this pair. */
public int getLarger()
} // end getLarger
/** Returns a new pair whose integers are the same as in
this pair, but whose first integer is the smaller one. */
public Pair getOrderedPair()
} // end getOrderedPair
public String toString()
return one + ", " + two;
} // end toString
} // end Pair
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here