CSSE 220 – Object-Oriented Software Development

Homework 21

Objectives

Practice object-oriented design.

Tasks

  1. Complete the assigned reading for the next session, according to the course schedule.
  2. Complete the assessment exercises over this reading on ANGEL (under Lessons → Assignments).
  3. Team Assignment: Working with your team, complete the assigned milestone of the Vector Graphics.
  4. Solo programming: Make a “good faith effort” on the following exercises from the Recursion project that you checked out in class. Your solutions to all the following must be recursive.
    1. Complete the isPalindrome() and isPalindrome(int first, int last) methods in the Sentence class of the examples package, if you have not already done so.
    2. Implement, including JUnit tests, the reverse() method in the Sentence class. How will you compare two Sentences in your unit tests? Options: compare the text strings by using the Sentence class' toString() method. Override .equals(). Your choice!
    3. Complete the recursive drawSierpinski() method in the SierpinskiRenderer class in the sierpinski package. This method should render the Sierpiński Triangle as shown in the figure below. The triangle is rendered by following these steps:
      1. Draw a solid equilateral triangle.
      2. In a contrasting color, draw another solid equilateral triangle whose corner points are the midpoints of the original’s sides.
      3. Repeat this process recursively for each of the three corner triangles. That is, you will need three recursive calls in your method.
      4. Technically speaking, this process is repeated an infinite number of times to create the true Sierpiński triangle, but we don’t have that much time. So, stop your recursion when the length of a side of the triangle becomes shorter than some fixed constant, say 5.
      Sierpinski Triangle

    Remember, in all your code:

    • Write appropriate comments:
      • Javadoc comments for public fields and methods.
      • Explanations of anything else that is not obvious.
    • Give self-documenting variable and method names:
      • Use name completion in Eclipse, Ctrl-Space, to keep typing cost low and readability high.
    • Use Ctrl-Shift-F in Eclipse to format your code.
    • Take care of all auto-generated TODO's.
      • Then delete the TODO comment.
    • Correct ALL compiler warnings.
      • Quick Fix is your friend!

    Here is the grading rubric for this assignment.

    Turn-in Instructions

    Turn in your programming work by committing it to your SVN repository.