Java for Programmers:
Lab 6
Alter Person. Create static final int variables to represent
the possible values for hair
color. We'll assume that there are only a certain number
of pre-defined hair colors for
simplicity's sake.
Create an instance variable in Person to store that particular
Person's hair color, as well
as getter and setter methods for the hair color.
Alter the Runner so that it sets the hair color of a Person.
When you set the hair color,
you should do so like:
setHairColor(Person.HAIR_COLOR_RED);
Create a switch statement to print out an appropriate message
based on what hair color the
person has.
Part 2: Create an Array of 3 People, all with different
names, ages and hair colors. Iterate
through the people and print out the name, age and hair color
of each
|