CSSE 220 – Object-Oriented Software Development
Homework 21
Objectives
Begin learning about recursion. Continue working with teammates on your project.
Tasks
-
Complete the assigned reading for the next session: §13.4–5. (See
schedule
for topics to focus on.) As you read, see if you can answer the self-check questions. If there is something you do not understand, make note of it so you can ask about it.
-
Edit the
Big Java Review Wiki
on ANGEL, adding answers to two of the review exercises from
chapter 13. Be sure to carefully follow the instructions for doing this that are posted on the Wiki.
-
Solo Programming:
-
Your programming work for this part must be done in the
Recursion
project inside Eclipse. Use the
SVN Repository Exploring
perspective to check out this project, then switch back to the
Java
perspective.
-
In-class exercise: Complete the
isPalindrome()
method in the
Sentence
class. Your solution must be recursive.
-
Implement, including JUnit tests, the
reverse()
method in the
Sentence
class. Your solution must be recursive.
-
Complete the recursive
drawSierpinski()
method in the
SierpinskiRenderer
class. This method should render the Sierpiński Triangle as shown in the figure below. The triangle is rendered by following these steps:
-
Draw a solid equilateral triangle.
-
In a constrasting color, draw another solid equilateral triangle whose corner points are the midpoints of the original’s sides.
-
Repeat this process recursively for each of the three corner triangles. That is, you will need three recursive calls in your method.
-
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
.
-
Team Assignment: Working with your team, complete the assigned milestone of the
Vector Graphics.
Turn-in Instructions
We will grade your Wiki contributions using ANGEL. Turn-in your individual work by committing it to your SVN repository.
See the
Vector Graphics assignment description for team project deliverables.