In Practicum you were introduced to a use for a static
variable, whereby all instances of a certain class in a program shared the
same variable. This allowed Patron objects (i.e.
Patron instances) to be created with auto-generated unique id
numbers. You have also already seen and used static methods with the
Test class's ck methods (e.g., ckEquals).
Static variables and methods are not associated with a specific object but
with a specific class.
This exercise will let you experiment with the static variable nextPatronID
private static int nextPatronIDand initialize it to
100001. The example from Practicum
initialized the variable to 1001. We are initializing the
variable to 100001 to represent a numbering sequence for
patrons who are children. Patron constructor that only takes a name
and phone number as parameters and then uses the nextPatronID
to assign the patron ID, as shown in Practicum. Don't forget to then
update the value of nextPatronID for the next
Patron created.Patron constructor. Be sure to verify
that the nextPatronID works as described in Practicum.main method of your Patron class
below: