Attached the files needed.
You'll need to do five things to satisfy this project's requirements:
1- Rewrite the given ArrayList class as a class template ArrayList<T>. It should take a single type parameter that specifies what kind of elements are stored in the array-based
list (e.g., an ArrayList<int> has integer elements, while an ArrayList<std::string> contains strings instead). Your new ArrayList<T> class template should completely replace the existing class (i.e., only turn in an ArrayList<T> class template, and do not change its name to something else), and it must be written in a file named [url removed, login to view] (i.e., replacing the files that were provided).
2- Rewrite the at() member functions so that they throw an exception when an out-of-bounds index is passed to them (e.g., someone asks for the element at index 5 when the ArrayList contains only 3 elements). Write a new class to represent this exception, though it doesn't need to contain any member variables or member functions.
3- Rewrite any other member functions so that the ArrayList is left in a valid state and memory does not leak if exceptions are thrown. (The most important one to pay attention to is the exception std::bad_alloc, which is thrown by the new operator when there is not enough memory to allocate what's been asked for.) Note that this doesn't mean the member functions shouldn't throw exceptions; it just means that when they do, the ArrayList is in a valid state and memory isn't leaked.
4- Write a short program — this project's app — that asks a user to type ten student IDs and names to the program's standard input (i.e., std::cin), one per line in the following format (i.e., the student ID as an integer, followed by a space, followed by the student's name):
123 Boo Thornton
4444 Joe D. Student
88 Alex Thornton
then prints the same data in a different format as follows:
Boo Thornton (ID#123)
Joe D. Student (ID#4444)
Alex Thornton (ID#88)
Use your ArrayList<T> class template to store the information while reading the input, then iterate through it to print the information back out. Feel free to assume that the input will be in the format specified; it doesn't matter what your program does if it isn't.
5- Using Google Test, write a suite of unit tests to verify that your newly-written ArrayList class template is complete and correct.
Compiling and running your project
Your ArrayList<T> implementation should be written in the core directory inside your project directory. The meager user interface can be written in a main() function in the app directory. Write your unit tests in the gtest directory, and feel free to write any experiments in the exp directory (experiments are not required).
When you're ready to compile it, change into the directory ~/projects/proj0 (if you're not already there) and issue the command ./build. (Note the dot and the slash in front of the word "build" — those are important! — and remember that you can tell that script what to build if you only want to build one thing, like app.) If compiling is successful, then issue the command ./run app to run your program, ./run gtest to run your unit tests, or ./run exp to run your experiments.
Also, if you want to check for misuse of memory, you can use the --memcheck option when you use the run script (e.g., ./run --memcheck app), which uses a tool called Valgrind to monitor memory usage.
How to solve the problem
Feel free to use the <iostream> and <string> headers in the C++ Standard Library, but don't use existing containers such as std::vector, since the goal here is to give your new ArrayList<T> class template a workout. Also, avoid smart pointers like std::unique_ptr or std::shared_ptr
13 freelancere byder i gennemsnit $32 på dette job
Hi, I am interested in your project and I would like to discuss. Relevant Skills and Experience C, C++, Linux, Programming, Proposed Milestones $29 USD - Open