Practice recursion.
isPalindrome()
and isPalindrome(int first, int last)
methods in the Sentence
class of the examples
package, if you have not already done so.
Implement, including JUnit tests, the reverse()
method in the Sentence
class.
How will you compare two Sentence
s in your unit tests? Suggestion: compare the text strings by using the Sentence
class’s toString()
method. (Later we’ll see how to define our own equals()
method. Feel free to look up how to do that if you’re interested.)
Sierpiński Triangle. This problem is due Tuesday of week 5. However, you should make a strong effort to get started on the problem. If you come to class on Monday having done any parts you find easy, then you can get immediate help on the parts you find hard.
This problem is in the SierpinskiTriangle project that you should check out from your individual SVN repository.
Complete the recursive drawSierpinski()
method in the SierpinskiRenderer
class of 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:
5
. Remember, in all your code:
Here is the grading rubric for this assignment.
Turn in your programming work by committing it to your SVN repository.