Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. Edit the Manager class to provide an instance variable called manages of type Employee[]. This variable should of course be private. In the constructor, initialise this giving the array a capacity of 100. Provide another instance variable to keep tract track of the last free position in the array.

  2. Define an instance method addEmployee(), taking an Employee reference as a parameter and returning void. Implement this method to add the employee object to the array, using the last free position variable. Do not forget to increment it afterwards!

  3. Define another method getEmployeeNames(), with no arguments, but returning String. Implement this method to loop around the collection, concatenating the names from each Employee. Finally return this String.

  4. Enhance EmployeeApplication, so that you have a manger who manages the other two employees!

  5. In Employee, override the toString() method to return the information about the employee. Use it in the loop in your main method!

  6. In Manager, implement the toString() method as well, but don't forget to incorporate the names of the employees the manager manages.

  7. As a stretch, try to create a manger who manages other mangers!