CSSE 221: Fundamentals of Software Development Honors
BigRational

Work on this exercise by yourself, but be quick to ask questions of your instructor, student assistants and classmates as desired.

Consider: When you see “Consider” in red, where do you go to report your answer to that question?
Consider: When you see “Consider” in red, do you go to the Angel report to answer that question right at that time or do you wait until you have done the rest of the exercise?
Consider: When you see “Consider” in red, at that point do you answer only the single question in that “Consider” or all the questions in the Angel report?

Goals

The goals of this exercise are to apply and hence reinforce your understanding of:

The Exercise - Overview

You will design, implement and test a BigRational class that:

    Instructions, Part 1 - Checkout the Project

  1. Open Eclipse.
  2. Checkout your BigRational project.
  3. Instructions, Part 2 - Implementing to an interface, with documented stubs

  4. Examine the ArithmeticObject and Comparable interfaces. In the next step, you will write a BigRational class that implements these interfaces.
    Consider: How do the ArithmeticObject and Comparable interfaces impact what you must do in your BigRational class?
  5. Add a BigRational class to your project.
  6. Have BigRational implement two interfaces, ArithmeticObject<BigRational> and Comparable<BigRational>, with only stubs for them at this time.

  7. Generate the Javadoc for the project. Examine the BigRational.html file, noting that Eclipse provided documentation for BigRational's methods for you (from the documentation for the interfaces).
  8. Instructions, Part 3 - Continuing the specification/design of BigRational

  9. Java interfaces do not specify constructors.
    Consider: Why not? What constructor(s) do you think that your BigRational class should   have? Explain.
  10. Add documented stubs for the two constructors listed in our answer to the previous question.
  11. Interfaces do not specify fields.
    Consider: Why not? What field(s) do you think that your BigRational class should   have? Explain.
  12. Examine the Java API specification for the Object class.
    Consider: Which of the Object methods do you think that your BigRational class should   override? Explain.
  13. Add documented stubs for the two methods listed in our answer to the previous question.
  14. You should now have stubs for two constructors and nine methods. If not, get help now.

  15. Examine the Java API specification for the BigInteger class.
    Consider: What BigInteger method will you use to implement BigRational's abs method? Why?
    Consider: Since BigRational deals with fractions, reducing to lowest terms is relevant. What BigInteger method will you use to reduce to lowest terms? Why?
  16. Instructions, Part 4 - Generate JUnit test stubs

  17. Generate JUnit test stubs for the eight methods of BigRational.
  18. Instructions, Part 5 - Use test-driven software development

  19. Implement and test your BigRational class, as follows:
  20. Instructions, Part 6 - Turn in your work (i.e., commit your project)

  21. Make sure that your project has correct style. Make sure that there is appropriate HTML documentation for all your public methods (inheriting the documentation from the interfaces is fine).
  22. Commit your BigRational project to the repository from which you checked it out.