UMBC CMSC 202, Computer Science II, Fall 1999

Project 2: Linked List - C++ Implementation

Due: October 14, 1999

See Also Project Notes, Questions and Answers


Objectives

The objectives of this project are to:


Background

In this project you will convert the C implementation of a linked list to C++, using classes and objects. Data items which were global variables in the last project will become private data members of classes. Most of the functions will become public member functions. It is important that you correct any defects in your Project 1 before beginning this project.

Tasks

  1. If you have any defects in Project 1, fix the problems and test throroughly as needed. Copy the source files (except for Proj1.c) into another directory and change the filenames so the extensions are .C and .H rather than .c and .h.

  2. You may use Date.H as is, or if you prefer, you may change the Date structure to a class.

  3. In Student.H, change the Student structure to a class. Put all the data members in the private section of the class. The public section should declare the following member functions:

  4. Revise Student.C so that it contains the function definitions for the member functions of the Student class. Be sure to:

  5. In ClassList.H, change the StudentNode and ClassList structures to classes. The pointers data and next should be private data members of the StudentNode class. The global variables head, tail, and numStudents should be private data members of the ClassList class.

  6. The public section of the StudentNode class should declare the following member functions:

  7. The public section of the ClassList class should declare the following member functions:

  8. Revise ClassList.C so that it contains the function definitions for the member functions of the StudentNode and ClassList classes. Be sure to:

  9. Test your changes using Proj2-test.C. Feel free to modify the main() function as you see fit.

  10. Do not proceed until you are thoroughly convinced that your linked list is functioning properly (including Insert(), Find(), and Delete()).

  11. Add a private data member to the Student class:

    	float gpa;    // Student's Grade Point Average (GPA)
    

  12. Add a public member function to the Student class:

    	//  This function returns the value of
    	//  the private data member gpa
    
    	float GetGpa (void);
    

  13. Add an additional parameter to the Student constructor. The additional parameter should be of type float and should be added to the end of the existing parameter list. Its purpose is to pass in an intializing value for the private data member gpa.

  14. Add a public member function to the ClassList class:

    	//  This function returns the sum of the
    	//  GPA's for all of the students currently
            //  stored in the list.
    
    	float GetGpaSum (void);
    

  15. Test your project using Proj2.C. Do not make any changes to this file other than adding comments or moving curly braces.

  16. Be sure that every source file has a header comment and that every function declaration in the .H files has a function comment.

  17. Be sure that the name of your executable is Proj2.

  18. For this project, you should submit a makefile and six source files named as follows:

    You may also submit additional files if you created any auxilliary source files. Do NOT submit your executable, object files, test data files, etc.


Last Modified: 2 Oct 1999 13:52:51 EDT by Alan Baumgarten, abaumg1@cs.umbc.edu

Back up to Fall 1999 CMSC 202 Section Homepage