Question: please help me with this error, here are my files ArraySet.cpp --------------------------------------------------------------------------------- /** @file * * @course CS1521 * @section 1 * @term Spring 2021

please help me with this error, here are my files
ArraySet.cpp
---------------------------------------------------------------------------------
/** @file * * @course CS1521 * @section 1 * @term Spring 2021 * * Implementation file for the class ArraySet. * * Adapted from pages 101-111 in Carrano 7e. * * @author Frank M. Carrano * @author Timothy Henry * @author Steve Holtz * * @date 28 Jan 2021 * * @version 7.0 */
#include
return itemCount; }
template
return !itemCount; // itemCount == 0; }
template
bool hasRoomToAdd(itemCount
if (hasRoomToAdd) { items[itemCount] = newEntry; ++itemCount; }
return hasRoomToAdd; }
template
int locatedIndex(getIndexOf(anEntry) ); bool canRemoveItem(locatedIndex > -1);
if (canRemoveItem) { --itemCount; items[locatedIndex] = items[itemCount]; }
return canRemoveItem; }
template
itemCount = 0; }
template
int curIndex(0);
while (curIndex
return false; }
template
int frequency(0); int curIndex(0);
while (curIndex
return frequency; }
template
std::vector
for (int i(0); i
return setContents; }
template
int searchIndex(0);
while (searchIndex
return -1; }
-----------------------------------------------
ArraySet.h
/** @file * * @course CS1521 * @section 1 * @term Spring 2021 * * Header file for an array-based implementation of the ADT set. * * Adapted from page 100 in Carrano 7e. * * @author Frank M. Carrano * @author Timothy Henry * @author Steve Holtz * * @date 28 Jan 2021 * * @version 7.0 */
#ifndef ARRAY_SET_ #define ARRAY_SET_
#include
#include "SetInterface.h"
/** @class ArraySet ArraySet.h "ArraySet.h" * * Specification of an array-based ADT set. */ template
/** Data storage. */ ItemType items[DEFAULT_CAPACITY];
/** Number of items in this set. */ int itemCount = 0;
/** Maximum capacity of this set. */ int maxItems = DEFAULT_CAPACITY;
/** Gets the index of target in the array 'items' in this set. * * @param target The ItemType value to retrieve the index of. * * @return The index of the element in the array 'items' that * contains 'target' or -1 if the array does not contain * 'target'. */ int getIndexOf(const ItemType& target) const;
public: /** Default constructor. */ ArraySet() = default;
/** Virtual destructor. */ virtual ~ArraySet() = default;
virtual int getCurrentSize() const;
virtual bool isEmpty() const;
virtual bool add(const ItemType& newEntry);
virtual bool remove(const ItemType& anEntry);
virtual void clear();
virtual int getFrequencyOf(const ItemType& anEntry) const;
virtual bool contains(const ItemType& anEntry) const;
virtual std::vector
#include "ArraySet.cpp"
#endif
------------------------------------------------------
SetInterface.h
/** @file 1 * * @course CS1521 * @section 1 * @term Spring 2021 * * SetInterface class template definition. * * Adapted from page 24-25 in Carrano 7e. * * @author Frank M. Carrano * @author Timothy Henry * @author Steve Holtz * * @date 28 Jan 2021 * * @version 7.0 */
#ifndef SET_INTERFACE_ #define SET_INTERFACE_
#include
/** @class SetInterface SetInterface.h "SetInterface.h" * * SetInterface abstract base class template. */ template
/** Gets the current number of entries in this set. * * @return The integer number of entries currently in the set. */ virtual int getCurrentSize() const = 0;
/** Sees whether this set is empty. * * @return True if the set is empty, or false if not. */ virtual bool isEmpty() const = 0;
/** Adds a new entry to this set. * * @post If successful, newEntry is stored in the set and the * count of items in the set has increased by 1. * * @param newEntry The object to be added as a new entry. * * @return True if addition was successful, or false if not. */ virtual bool add(const ItemType& newEntry) = 0;
/** Removes one occurrence of a given entry from this set, if * possible. * * @post If successful, anEntry has been removed from the set and * the count of items in the set has decreased by 1. * * @param anEntry The value of the entry to be removed. * * @return True if removal was successful, or false if not. */ virtual bool remove(const ItemType& anEntry) = 0;
/** Removes all entries from this set. * * @post This set contains no items (thus the count is 0). */ virtual void clear() = 0;
/** Counts the number of times a given entry appears in set. * * @param anEntry The value of the entry to be counted. * * @return The number of times anEntry appears in this set. */ virtual int getFrequencyOf(const ItemType& anEntry) const = 0;
/** Tests whether this set contains a given entry. * * @param anEntry The value of the entry to locate. * * @return True if this set contains anEntry, or false * otherwise. */ virtual bool contains(const ItemType& anEntry) const = 0;
/** Converts this set into a vector. * * @return A vector containing all the entries in this set. */ virtual std::vector
// virtual ArraySet
#include "ArraySet.cpp"
#endif
ArraySet.cpp:21:13: error: expected initializer before k token int ArraySet
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
