CSCI 261 - Programming Concepts - Spring 2022

Lab 4D - A Linked List Class Part II: Construct/Destruct a List

This lab is due by Tuesday, March 29, 2022, 11:59 PM.
As with all labs you may, and are encouraged, to pair program a solution to this lab. If you choose to pair program a solution, be sure that you individually understand how to generate the correct solution.


Instructions


Make a copy of your ending point from Lab4C as we continue to modify and build out our class.


Class Declaration


We will begin refactoring our LinkedList class. First, denote separate public and private sections of our class. Our data members and the makeNodeForValue() method will all be private. Be sure to follow our naming scheme style. The remainder of the existing methods will be public.

We no longer have direct access to our data members, so we will add some public accessors for them. Think about why we won't be having public mutators for the data members. Create the following public methods:

  1. Name: front
    Input: none
    Output: an integer

  2. Name: back
    Input: none
    Output: an integer

  3. Name: size
    Input: none
    Output: an unsigned integer

Lastly, declare a constructor and destructor for the class.


Class Definition


In a separate LinkedList.cpp file, we'll now make the implementations for each method. Below are the tasks each method should be performing:

Be sure to save a snapshot of your code at this point. We will make a copy to start Lab4E as we continue to modify, build out, and test our class.


Lab Submission


Submit your Node.h, LinkedList.h, LinkedList.cpp file(s).

You will submit your solution to this lab with the rest of Set4. Detailed instructions for doing this are posted in Assignment 4.


This lab is due by Tuesday, March 29, 2022, 11:59 PM.
As with all labs you may, and are encouraged, to pair program a solution to this lab. If you choose to pair program a solution, be sure that you individually understand how to generate the correct solution.