Question
All info and data is provided. You will modify the Linked List of Integers program that we have discussed in lecture. The draft listInt class
All info and data is provided.
You will modify the Linked List of Integers program that we have discussed in lecture. The draft listInt class is flawed and you are assigned to fix the class especially these three functions:
- The destructor
- The copy constructor
- The assignment operator
Begin by downloading the draft version of the listInt class from Canvas. There are three files:
- listdriver.cpplistdriver.cpp no need to modify
- listInt.h
- listInt.cpp
The driver main program should not be modified. It provides basic testing of the listInt class for you. Modify listInt.h and listInt.cpp by adding the three functions specified. I suggest starting with the destructor and then checking if your program runs. Then do the copy constructor and again check if your program runs. Lastly, do the assignment operator and check to make sure all the commands are working as expected in the driver program.
You may choose to add some private member functions to create a good modular design. These are called utility functions and are handy inside the class definitions. For example, a private destroy() function and/or a private copy() function. The destructor and assignment operator would use the destroy() function. The copy constructor and assignment operator would use the copy() function.
The dos2unix filename command may be needed to strip out extra characters added to the source code files.
The REQUIRED output is shown below.
sample output
Note that you should also add a cout statement to the Add member function. That prints the "Adding Node..." message. You will also have similar cout statements in other member functions to generate this output. For example in the destructor you will have a cout statement stating each time you delete a node.
These cout statements would be later removed once complete testing of the listInt class was complete. These messages are intended to help you learn what your code is doing and help you debug problems. Therefore for this laboratory you are to submit with the cout statements STILL INCLUDED. After this laboratory make sure to remove these types of statements from future submissions unless specified differently. Generally good programming style would be to NOT print to the screen inside member functions.
Grading
The assignment will be graded in accordance with the Labs and Programming Assignment Expectation handout and the rubric posted on Canvas. Failure to adhere to the guideline could result in losing points.
Submitting your Program
You must submit three files:
- The header file: listInt.h
- The implementation file: listInt.cpp
- The driver program: listdriver.cpp
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started