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 a “Consider question”, you might want to think about what it is asking and jot down your answers.

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 nine methods of BigRational.
  18. Instructions, Part 5 - Use test-driven software development

  19. Implement and test your BigRational class, as follows:
  20. Remember, in all your code:

    Here is the grading rubric for this assignment.

    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 are appropriate Javadoc comments 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.