74939393930003456 / 83838384550230300266666629999
BigInteger
class. Why is it useful? Why not just use int
s?BigInteger
implements Comparable
.Comparable
interface and figure out what it is all about. What method(s) must a class implement if it implements Comparable
?
BigInteger
have a compareTo()
method? (Navigate back there to check.)BigInteger
have a compareTo()
method?implements Comparable<BigRational>
after the name of the class. This will stub in the methods that are part of the interface.
(Stubs are just empty method bodies.) BigInteger
class should reveal a method that will save you
lots of time here.
equals()
and toString()
methods.
Note: until you write equals(),
it always returns false. Your implementation of toString()
should be simple—just
format in the form a/b—but be sure to
format to the reduced form of the fraction. Examples:
toString
and each Arithmetic method.
We'll discuss this in class in Thursday. You will be graded on how well you choose your test cases.BigRational
is an immutable class. Each math method should return a brand new object, leaving the operands untouched.
In all your code:
Here is the grading rubric for this assignment. |
Turn in your programming work by committing it to your SVN repository for this project. Make sure that your unit tests are committed as well!