$29
Project description
Typically students write buggy code and it falls on the graders to gure out what’s wrong. This assignment stands Hegel on his head and asks you to x already buggy code. In particular, it will introduce you to a variety of memory access and memory management errors that are common in C and C++.
The Array class
The Array class is de ned in array.hpp and implemented in array.cpp. It is an implemen-tation of a simple array class for double precision numbers. It is similar to the Vector class discussed in Chapter 2 of Stroustrup.
What to do
The goals of this project are:
make as few changes to array.cpp as possible to x the code so that there are zero memory access and memory management errors, and
achieve 100% test coverage of array.cpp as reported by gcov and zero errors reported by valgrind.
With about a dozen or so minor changes you should have code that works correctly. What you should not do is to rewrite the whole thing from scratch, nor may you add any header les in array.cpp.
Be sure that your working version of array.cpp does not have any stray debug output remaining when you submit it.
Do not modify the code in array.hpp!! There is no need to do so, and I will use an unmodi ed version of array.hpp when testing your code. If your code relies on modifying array.hpp, then you should expect your code to fail my tests.
What to submit and how
Inside your cs303 git repository you should create a new directory named array. This will be the folder for this project.
You should add and commit the following les inside array to the repository:
1. array.cpp, which contains the corrected implementation of the Array class,
2. main.cpp, which contains your test driver that tests 100% of array.cpp,
3. array.cpp.gcov, which contains the gcov test coverage results from applying main.cpp to test your corrected implementation, and
4. valgrind.txt, which contains the output from testing your corrected implementation under valgrind.
Be sure to push your changes to gitlab.com.
This is the tree structure your repository cs303 should have when you are done. Leaves are les and all the other nodes are directories:
cs303
hello world array
array.cpp
main.cpp
hello.cpp
array.cpp.gcov
valgrind.txt
I will pull your code from gitlab.com (make sure you shared cs303 with me!) to grade.