This activity uses the ArrayList class.
In addition to the Solution document, the project for this activity contains three classes:
An instance of LinkingInfo contains the name of a computer on a local network, together with the names of all the computers to which it is linked. The names of the linked computers are held in an ArrayList instance.
The class has the following methods:
returns the name of the computer.
returns the number of computers that are linked to the first computer.
returns true if the computer comp1 is linked to the computer documented by this object, otherwise it returns false.
adds the name of computer comp1 to the list of linked computers. If the name is already in the list a ComputerErrorException exception is thrown with the message "Computer XXX already in links".
removes the computer named comp1 from the list of linked computers. If the name is not in the list a ComputerErrorException exception is thrown with the message "Computer XXX not in links".
prints a list of the linked computers.
The methods for adding and removing names are incomplete. Your job is to write these methods as specified above.
Open LinkingInfo and complete the methods addComputer and removeComputer in the places indicated.
Run the project, and check that the output is as you expected