Exercise 11.1 Create a class Person: with name, eyecolor, date of birth, and address. Create a class Address with city and zip code only.
Define three a Address objects and four Person objects. Design examples to illustrate the problem with assignment and mutation. Write comments explaining the problem.
Define a shallow copy constructor for the class Person and show on examples when it fails.
Define a copy method in the class Person, which returns a new copy of the given object. Design and run test that verify that your code works properly.
Define the method equals, which compares two person objects and returns true if the two people have the same name, eyecolor, date of birth, city, and zip, even if they are not represented by the same object. Design tests to verify that your method works correctly.
Exercise 11.2 Start with an array of Person. Experiment with making copies of the array, modifying people in the first array, observe what happens in both. First make the copy by assignment, then using the incorrect copy constructor, then using the copy method developed in the previous exercise.