CMPT 126 - Harbour Centre - Fall 2006
Home  
Assigned Readings  
Examples  
Labs  
Assignments  
References  
Gradebook  
 
  In this lab, you will create a class representing a school club. You will need to use the Student class presented in lectures. In order to do so, you should save the java source Student.java from the examples page then compile it in the same directory that you make your new class for this assignment.
  1. Create a class Club that represents a simple school club. Every club must have a name, and it must have a current membership consisting of students (represented by Student objects). Every club can include at most 10 students.

    Your class should include 2 constructors:

    1. Club(String name): Initially no members.
    2. Club(String name, Student[] students): Initial members given by the array.

    Your class should include a getter and setter for:

    1. Club name

    Your class should have a method addStudent(Student s) that adds a given student to the club.

    Your class should also have an overloaded method removeStudent specified as follows:

    1. removeStudent(long idnumber): Removes any student with the given student number.
    2. removeStudent(String userid): Removes any student with the given userid.

    Finally, your class should contain a method listMembers() that lists the members in the format
    Student Number: Last Name, First Name
    with each student appearing on a new line.

  2. Create a text file named time.txt. In it, indicate how long it took you to complete this lab exercise.

When you're done, create a ZIP file containing all of the files you created for this lab and submit it with the submission server. Remember to include an additional class for testing your work.