Change the constructors so that they properly maintain


Static variable. Add to class Person a private static field that contains the number of Person objects that have been created so far. WHENEVER A Person OBJECT IS CREATED, THIS FIELD SHOULD BE INCREASED BY 1.
Add a public static int function population, with no parameters, that will return the value of the static variable.
Change the constructors so that they properly maintain the value of the static variable.
Finally, add test cases to class PersonTester to test whether the static variable is properly maintained. Because you may not know the order in which the testing procedures are called when you click button Test, test the change in the static variable's value as follows: (1) save its value in a local variable, (2) write a statement that you expect will change the static variable, say, by 1, and (3) write an assertEquals statement to test whether the change in the static variable was indeed 1.

Request for Solution File

Ask an Expert for Answer!!
Basic Computer Science: Change the constructors so that they properly maintain
Reference No:- TGS0145967

Expected delivery within 24 Hours