Objective: Create Basic Java classes.
Due: Before the next class (Monday).
Create a directory for assign2
within
your cs209
directory.
Save Assign2.java into
your assign2
directory.
This program contains at least 5 errors. Some are compiler errors that the compiler will catch. Others are logic errors that you need to catch. One is an access modifier error that is not good OO style.
Comment out the original code and note the cause of the error. Then, correct the code.
After you're sure the program behaves correctly, save the output in
a file called debugged.out
.
Create a Birthday
(but not birth date) class.
The state of the class should be the month
and day
.
The methods of the class should be getting and setting the month and date.
Pay close attention to the access modifiers you use for the state and methods.
The main
method for the class should test
your Birthday
class, including creating objects using
both constructors. Don't just rerun the program a bunch of times,
changing the code and recompiling and running. Have all the tester
code in this method.
This problem is "underspecified", e.g., I'm not saying how to represent the month and day. I'm leaving that up to you. The problem also doesn't seem like one of my normal problems... We're building to something.
Save the output of your program
in birthday.out
As usual, copy your assign2
directory
into your turnin directory,
i.e., /csdept/local/courses/cs209/turnin/yourusername
.
There is no printed part of this assignment.
You will be evaluated based on