Dear
all,
For our next discussion
on Monday, I’ll be doing something different. In the previous discussion
classes, I always give you some discussion questions. However, in this class,
I’ll give a short programming exercise to test your understanding about Class in
Java. I’ll prepare one programming
problem for you to try in the class. You can open anything: Java API, your
lecture notes, and textbook.
Oh yes, you can find
the answer for the previous discussion questions (discussion 3) in my website:
www.comp.nus.edu.sg/~johannes#teaching
So, things that we are
going to do in the class are as follows:
1.
Emphasize
on some important concepts in the
last lecture (testing & debugging). This will take approx. 20
mins
2.
Programming
exercise. This will take
approx. 40-50 mins
3.
Review of
previous labs (Lab 1 and 2) and Lab 3. This will take approx. 30
mins
Regarding your labs,
there’s a delay in releasing the result of your first lab because of some
problems in CourseMarker marking site. I’ve also finished grading your second
lab. If you have received the result of your lab (through e-mail), you’ll be
able to see the comment from me in this form:
//
johannes:
// -- my comment
–
//
...
There are some common
mistakes which need to be highlighted:
1.
Some of
you forgot to write your name in
the top part of your program. It’s important for you to write your own name in
the space provided there, so I don’t need to go through the class list and check
whose program is this.
2.
Writing
comments (although the program is
still simple) is important.
3.
Most of
you forgot to remove Aaron’s name
from your program. I supposed that Aaron has already told that you must remove
his name from all of your programs, because it’s your program, not
his.
4.
Actually
this is not a mistake, but an advice from me: it’s a good programming practice
not to import any packages which you do not use in your program, and not to
declare variable which you do not use as well.
5.
In your
Lab2Ex1: some of you didn’t use
the computeArea() method inside Circle
class to compute the area of the circle. Instead, some of you compute the area
of the circle in the main method.
6.
In your
Lab2Ex1: the erroneous method
which you need to change is: void setRadius
(double radius); Some of you failed to
notice this. I’ll give a further explanation in the
class
7.
In your
Lab2Ex2: you should use the
getX() and
getY() method to get the
coordinates for a certain point. Therefore, when printing out the coordinate,
you should use df.format(p.getX()); for
example.
8.
In your
Lab2Ex2: some of you didn’t use
the MyPoint class inside your main method at all.
Looking at your result,
I’ll take some times to go through your second lab.
That’s all from me
& happy weekend!
Best
regards,
School of
Computing
e-mail:
johannes@nus.edu.sg