Name
__________________________ Date:
___/___/____
Mr. Merlis Block
___ -
BDF___
JAVA 1 Day
of Class: __38__
JAVA 1 – Making a Class and its App
Our job is to create a Person class and its application
program PersonTester. The Person class
should keep track of a person’s first name, last name, age, and favorite
color. The Person class should have two
constructors, one that takes no parameters and one that takes a parameter for
each of the four instance variables.
The constructor that takes no parameters should create a
Random object and use it to give the person either the name “John Doe” or “Jane
Doe” with (approximately) a 50% likelihood of either. It should make the person a random age
between 0 and 80 years old with a favorite color of blue.
The four parameter constructor should initialize all of the
private instance fields to its appropriate parameter in the constructor’s
header.
The Person class should also contain accessor methods that
return the values for the private instance variables.
It should have the methods:
Lastly, be sure to include a toString()
method to print all the information about the person.
The application program
should do the following: