Project #5 implementing a re-sizable Vector ADT




5/5 - (2 votes)

Project #5
COSC 052
This project involves implementing a re-sizable Vector ADT using a dynamically-allocated C array. The class
declaration is shown below and is available on Canvas for download.
Documentation for this class and its methods is available for download on Canvas and on-line at:
As with previous projects, test your implementation of the Vector<T> class in main.cpp. We will use our own
main function to evaluate your class. You must not modify the class name or the public interface. Our main.cpp
will include only main.h, so put all necessary includes there. You should not need to declare any additional
methods or data members. Use the Makefile from the previous project with the appropriate modifications.
Academic Integrity
This is an individual project and all work must be your own. Refer to the guidelines specified in the Academic
Honesty section of this course syllabus or contact me if you have any questions. In a file named HONOR, please
include the statement:
Include this file in your zip file
In accordance with the class policies and Georgetown’s Honor Code, I certify that, with the exceptions of the
class resources and those items noted below, I have neither given nor received any assistance on this project.
template <typename T>
class Vector {
Vector( const unsigned ) throw ( bad_alloc );
Vector( const unsigned, const T& = T() ) throw ( bad_alloc );
Vector( const Vector<T> & ) throw ( bad_alloc );
void assign( const unsigned, const T& ) throw ( out_of_range );
T& at( const unsigned ) const throw ( out_of_range );
unsigned capacity() const;
void clear();
bool empty() const;
void insert( const unsigned, const T& ) throw ( bad_alloc, out_of_range );
T& operator[]( const unsigned ) const throw ( out_of_range );
const Vector<T> &operator=( const Vector<T>& ) throw ( bad_alloc );
void push_back( const T& ) throw ( bad_alloc );
void resize( const unsigned, const T& = T() ) throw ( bad_alloc );
unsigned size() const;
void sort();
void remove( const unsigned ) throw ( out_of_range );
T* contents;
unsigned sz;
unsigned cap;
void increaseCapacity() throw ( bad_alloc );
}; // END Vector<T> class declaration
16 April 2019 Project #5
COSC 052 Spring 2019 Page 2 of 2
Instructions for Electronic Submission
Your project must be submitted no later than Monday, April 29, 2019 at 11:59pm. Late submissions will be
penalized 1 point for each minute. In general requests for extensions will not be considered.
You will submit Project 5 in the same way you did the previous projects. (Plan B: ONLY in case of some
catastrophic issue with the AutoLab system, one of the servers, or if you have some serious extenuating
circumstances, then upload your zip file to Canvas).
Emergency Backup
Once you’ve submitted your project, it is important to keep an electronic copy on a university machine such as the
class server (cs-class) that preserves the modification date and time. If we lose your project or the submission
system breaks, then we will need to look at the modification date and time of your project to ensure that you
submitted it before it was due. Retain either the zip file or the directory containing your project’s files.
This graded assignment is worth 100 points and will be counted as part of the Programming Projects category for
the course. Your final score is based on automated tests performed by AutoLab, as well as a manual review
conducted by one of our Teaching Assistants (TAs). We will talk about the AutoLab tests in class and you will be
able to see exactly what those are when you submit for the first time. The rubric used by TAs for their manual
evaluation will be published separately.
Course Materials Notice
The materials used in Georgetown University courses (“Course Materials”) generally represent the intellectual
property of course instructors which may not be disseminated or reproduced in any form for public distribution
(e.g., sale, exchange, etc.) without the written permission of the course instructor. Course Materials include all
written or electronic documents and materials, including syllabi, current and past examination questions/answers,
and presentations such as lectures, videos, PowerPoints, etc., provided by a course instructor. Course Materials
may only be used by students enrolled in the course for academic (course-related) purposes. Published course
readings (book chapters, articles, reports, etc.) available in Canvas are copyrighted material. These works are
made available to students through licensed databases or fair use. They are protected by copyright law, and may
not be further disseminated or reproduced in any form for distribution (e.g., uploading to websites, sale, exchange,
etc.) without permission of the copyright owner. More information about intellectual property and copyright can
be found here: More information about computer acceptable use
policy and intellectual property can be found here:
This document: Copyright © 2019 W. A. Woods. All Rights Reserved. This material may not be published,
broadcast, rewritten, or redistributed.
On-line documentation: Copyright © 2019 Mark Maloof. All Rights Reserved. This material may not be published,
broadcast, rewritten, or redistributed.