Write a Person
class that describes a person in terms of their name and their age.
The Person
class should have two constructors: one for a person with a specified name and a default age of 0, and one for a person with a specified name and age.
Write accessor methods for the two instance variables, getName()
and getAge()
, along with two mutator methods:
celebrateBirthday()
, which increases the person’s age by 1, andchangeName()
, which takes a single variable as a parameter and updates the instance variable to the new name.Write a program PersonTester
with a main()
method that demonstrates creating and using the Person
class.