Activity 3.5 - Using an array of a reference type

Topic

In this activity you will develop a class GroupRecord which uses the class you wrote for the last activity.

Materials

In addition to the Solution document, the project for this activity contains the classes:

Task

You are asked to develop a class an instance of which will maintain a list of Member objects in an array, and provide methods to locate and access the stored objects.

The class requires:

  1. an array of Member objects, with a default size of 100.
  2. an instance variable to record how many members are currently listed.
  3. a single zero-argument constructor that initialises the array variable to a new array of the default size, and the other variable to zero.
  4. three public methods:
  5. a helper method findIndex(String name) that will locate the array index at which the Member's name passed as an argument is stored in the array.
    You may assume the array will always contain the object in question.

Instructions

Write the code for the class GroupRecord to comply with the requirements above and run the project to test what you have done.