- Complete the assigned reading for the next session (see the
course schedule). If there is something you do not understand, make note of it so you can ask about it.
Estimated time: 20 minutes.
- No Angel quiz this time. The next ANGEL quiz will include material
from this reading assignment.
- Finish the Points, Rectangles, and Circles Exercise begun in today's class.
that you checked out from your repository. I.e., write the remainder of the Point,
Rectangle, and Circle methods described here.
Write javadoc for everything. Add CircleTest.java to your
project (in the same place as the pdf'd javadoc, accessible from the
Schedule page) to test your code, writing JUnit tests
to test sufficiently your methods.
Estimated time: 50-60 minutes if you are a student who
did well in 120 and are still confident about the Object-oriented material
from that course.
If you are very shaky on that material and find this assignment
difficult, you need to keep pressing on, get help as needed, and get
it done. I recommend for everyone that you start this
assignment during the first class period during which you do not
have class, so that you can scope out whether you are likely to need
help, and plan to go to the lab this afternoon or this evening.
If you find yourself spending more than 5 minutes on any method
(except possibly the intersects/intersection methods), you should
probably skip that method, move on and do some others, and come back
to the hard one if you get time later.One more note on intersects and intersection: I am
referring to intersections of the boundaries and/or interiors of the
rectangles, not just the boundaries. Thus if one rectangle
completely contains another one, we will consider them to intersect.
BONUS: The intersects(Rectangle r)
method of the Circle class is fairly tricky. At first I was erroneously thinking that you only needed to check whether
the circle's boundingBox intersects the Rectangle. As you probably
already know, that is a necessary but not sufficient condition for
intersection. To obtain bonus points, you must identify the other
tricky cases (demonstrated by writing the appropriate unit tests) and write code that checks for them. You may add other
methods to Circle or Rectangle to make this easier.
Commit your work to your SVN repository, making sure that you
check each new file that you created.
[Side note: here's how to create a JUnit test suite from scratch, say for the Circle class.
You don't need to do this, but we'll do something similar later this
week:
- Stub in or write each method in the Circle class.
- Right-click on the Circle.java file, and choose New > JUnit Test
Case. The default name will be CircleTest, which is OK. Click Next.
- In the next screen, check any Circle methods you think need to
be tested. (Hint: all of them, except the constructor, getRadius,
and getCenter(), perhaps).
- It will create empty test methods. You should fill these in,
using assertEquals like I did in my tests. (Other tests like
assertTrue and assertFalse for methods that return booleans) can be
helpful as well; you can easily get a list by typing
TestCase.
inside one of the methods, and it will give the whole list.)
]