Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Requirements: NOT using any container classes defined in STL , implement all functions declared in tvector.h in a separate file called tvector.hpp . Note tvector.hpp

Requirements: NOT using any container classes defined in STL, implement all functions declared in tvector.h in a separate file called tvector.hpp. Note tvector.hpp is included in tvector.h. You may used standard C++ I/O libraries, as well as class libraries like string.Using the tag "-std=c++11", write a Makefile (5pt) and put it in the same folder with tvector.h, tvector.hpp and driver.cpp. The Makefile should compile the driver.cpp driver into an executable called proj1.x. Your program must be able to compile and run on the linprog machines as this is where TAs will test your code.Screen out compilation errors. One compilation error costs you 50pt. You will automatically get 0/100pt if there are >=2 compilation errors. Write a variety of test cases to screen out crashing when running proj1.x (10pt). In judging your code, TAs will test on two different input files. If no crash on both test cases, you obtain the 10pt. If your code crashes on both, you only obtain the 5/100pt if your Makefile is correct. Therefore the crash (like segmentation fault) costs you not only these 10pt, but also the 85pt in the main programming part even if you write a few functions correctly. If your program crashes on one of two test cases, then you obtain 5pt/10pt, but the TA will look at each of your function and give you points for the functions you correctly implemented. Important: make sure your code does not crash on the given driver.cpp test case. Obtain your result by running driver.cpp. Debug until you get the same result as the provided file driver_output.txt. Submission:Tar up your tvector.hpp and Makefile into a single tar archive and submit online via Canvas, in the "Assignments" section.To do that, copy these two files to a separate folder. Use the linux command "tar -zcvf tarfilename.tar /path/to/folder/" in which /path/to/folder is the folder which contains only these two files (vector.hpp and Makefile), and tarfilename.tar should be lowercase: lastname_firstname_p1.tar. Example: to tar a folder whose path is /mypath/to/folder/, and generate my submission, I will use this command "tar -zcvf mallory_xian_p1.tar /mypath/to/folder". You should replace with yours for the tar file and path to folder. Use the Assignment 1 link to submit this .tar file.To check if you tar your programs correctly, you can use command "tar -tf tarfilename.tar" to see if the two files are in your tar file already.Information:Define all of the functions for these classes in the file tvector.hpp.Always make sure there is ROOM in the array before inserting a new item. If you ever try to insert data, and the array is full (to capacity), then increase the capacity by doubling it.Do NOT change any of the prototypes or member data declarations in the tvector.h file at all. All current declarations have the intended prototypes, and they will need to work with my main programs.Clean up dynamic memory in appropriate places and do not leave any memory leaks.tvector class templateThe member data of this class consists of a pointer to a dynamically managed array, along with tracking variables for the capacity and the size. Note that the capacity refers to how much space is currently allocated, and size refers to how many data items are currently stored.There is a dummy variable of type T that can be used for error-checking situations. Specifically, whenever a function is to return a stored data item but the container is empty, return (a reference to) the dummy object. Whether you should return the dummy object itself or a reference to it depends on how the function is declared.A static constant called SPARECAPACITY is in the member data so that it can be used to add some extra capacity when constructing vector objects.Iterators1. The small class called TVectorIterator is a helper class that can be used in conjunction with the vector class. This is a common feature used in container classes like this. The purpose of an iterator is to provide a common and non-implementation-specific way of traversing a container, so that mulitple containers could potentially use common algorithms (like sorting and searching functions, for example). For the iterator class in this assignment, here is a brief sample use

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Processing Fundamentals Design

Authors: Marion Donnie Dutton Don F. Seaman

14th Edition Globel Edition

1292107634, 978-1292107639

More Books

Students also viewed these Databases questions

Question

Define Management or What is Management?

Answered: 1 week ago

Question

What do you understand by MBO?

Answered: 1 week ago

Question

What is meant by planning or define planning?

Answered: 1 week ago

Question

How do Dimensional Database Models differ from Relational Models?

Answered: 1 week ago

Question

What type of processing do Relational Databases support?

Answered: 1 week ago

Question

Describe several aggregation operators.

Answered: 1 week ago