Tips for Assignment 2
These are dated so that you can see what (if any) has been added or changed since the
last time you checked.
- [1/30] Read the handout CAREFULLY.
- We are quite EXPLICIT about much of what you must do, e.g. the precise name of field
boxColor.
- [1/30] How to add field boxColor of type Color.
- Mimic the existing declarations. For example, "public int xUpperLeft" declares
a field (named) xUpperLeft of type int.
- In this case, you want type Color instead of type int, and field name boxColor instead
of xUpperLeft. Note that "Color" will not be syntax-colored blue like
"int", but black. You'll probably want/need to declare it to be
"public", just like the other fields.
- [1/30] How to set/initialize field boxColor
- Merely assign to field boxColor, just like with xCenter or xUpperLeft -- there is no
need for "new".
- [1/30] How to declare and use local variables of type int.
- These declarations are much like the declarations for the fields of class Box (except
that you omit the keyword "public"): you need to give the type and the name of
each local variable (followed by a semicolon and a comment). Again, you need merely assign
to
these local variables; again there is no need for "new".