BigRational

Work on this exercise in pairs.

If there are an odd number of students in your section, you may ask the instructor to work alone. In general only one student will be permitted to do so—pair programming is a skill we want you to continue to develop.

Let your instructor know who you are working with on the project so that he can set up your project in Subversion.

Goals

The goals of this exercise are:

The Exercise

Design and implement a BigRational class that:
  1. With your instructor—either during work time in class or outside of class—discuss the design of your BigRational class. You should write down brief notes/questions on the following topics before you have this discussion:
    1. Examine and discuss the Rational interface
      • How does the Rational interface impact what you must do in your BigRational class?
    2. Examine and discuss the Comparable interface
      • In the javadocs, what does the <T> mean in the name of the interface?
      • What does the T mean in the signature of the compareTo(T o) method?
      • How does the Comparable interface impact what you must do in your BigRational class?
    3. Interfaces do not specify constructors
      • Why not?
      • What constructor(s) do you think that your BigRational class should have?
    4. Interfaces do not specify fields
      • Why not?
      • What fields(s) do you think that your BigRational class should have?
  2. Implement your BigRational class, as follows:
    1. You may NOT change the Rational interface in any way.
    2. Check out the BigRational project from the new Subversion repository created for this exercise. The repository URL is http://svn.cs.rose-hulman.edu/repos/csse220-200730-username1-username2, substituting your usernames in alphabetical order.
    3. Run the project as a JUnit test.
    4. Modify the project so as to add test code for each of the methods you plan to implement.
    5. Please show your test code to your instructor or an assistant before proceeding to the next step, i.e. the implementation of your methods.
    6. Design, implement, and debug the methods as required by the interface. You will find the BigInteger class useful in your implementation.