For each programming problem below, you should follow a 6-step recipe:
I want a log of everything that went wrong in the development of your programs. Ideally, each log entry should include
In DrJava, open the Point
class I provided on the
universal share drive; let's say, version 5. Write an
additional method named rightOf
that takes in a
Point
parameter named that
,
and returns a boolean indicating whether this
is to the
right of that
.
I've given you the answers to step 1: the method is named
rightOf
, it returns a boolean
,
and it takes in a Point
named that
. Write
these down and turn them in anyway, along with your test cases and
code.
In DrJava, open a new file.
Person
that
contains three pieces of information:
firstName
, lastName
, and
age
, of appropriate data types.
toString
method to the
class, combining the first and last names and the age in a
user-friendly manner and returning the result as a String. olderThan
method to the
class, taking in another Person and returning a boolean indicating
whether this
Person is older than the other Person.
Replace the olderThan
method with a
youngerThan
method (or, if you prefer, add
the youngerThan
method so you've got both). This method
should, of course, have its own test cases and all that. Also
record how long it takes you to make this modification.
Do the exercises in the section entitled "CH 2: objects, classes, & methods". These don't have to be finished by Feb. 13, but they'll be most helpful if you do them around the same time as you're doing the rest of this stuff.
rightOf
problem, turn in the names and types
(step 1), test cases (step 2), Java code (step 3), and an error log.
(If you encountered no errors at all in solving this problem, say so
explicitly.)
I suggest putting step 1, step 2, and the error log together in
one file (say, "Point.log").
Person
class definition, I assigned four
successive versions. I want
names and types (step 1) for all four versions,
test cases (step 2) for all four versions,
a single Java file containing the class definition and all three methods,
and an error log for everything that went
wrong in developing this program (if you encountered no errors, say so).
Again, I suggest putting step 1, step 2, and the error log together in one
file ("Person.log"); here's a sample.
Problem | Names and types | Test cases | Java Code | Error log |
---|---|---|---|---|
rightOf |
/5 | /5 | /10 | /5 |
Person |
/5 | /5 | /10 | /5 |
toString |
/5 | /5 | /10 | /5 |
olderThan |
/5 | /5 | /10 | /5 |
constructor | /5 | /5 | /10 | /5 |
Total: | /125 |