This activity involves adding methods to the existing ComputerCollection class. It also requires an additional instance variable to be declared and initialized, and an extra statement to be added to an existing method.
In addition to the discussion of the solution in the Solution document, the project for this activity contains two classes:
A ComputerCollection keeps track of computers connected to a network. (For the purpose of our activity a computer is represented by a string corresponding to its name.) Methods already exist to add a computer to the network, and to remove a computer, as well as to tell the index of a computer in the collection.
The project will not compile at this stage.
Open the class ComputerCollection and study the code there. Read the comments and insert the necessary statements at the numbered points.
Examine the class ComputerCollectionTest to see what it does with the collection. Run the project to test your answer.