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

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 template int ArraySet::getCurrentSize() const {

return itemCount; }

template bool ArraySet::isEmpty() const {

return !itemCount; // itemCount == 0; }

template bool ArraySet::add(const ItemType& newEntry) {

bool hasRoomToAdd(itemCount

if (hasRoomToAdd) { items[itemCount] = newEntry; ++itemCount; }

return hasRoomToAdd; }

template bool ArraySet::remove(const ItemType& anEntry) {

int locatedIndex(getIndexOf(anEntry) ); bool canRemoveItem(locatedIndex > -1);

if (canRemoveItem) { --itemCount; items[locatedIndex] = items[itemCount]; }

return canRemoveItem; }

template void ArraySet::clear() {

itemCount = 0; }

template bool ArraySet::contains(const ItemType& anEntry) const {

int curIndex(0);

while (curIndex

return false; }

template int ArraySet::getFrequencyOf(const ItemType& anEntry) const {

int frequency(0); int curIndex(0);

while (curIndex

return frequency; }

template std::vector ArraySet::toVector() const {

std::vector setContents;

for (int i(0); i

return setContents; }

template int ArraySet::getIndexOf(const ItemType& target) const {

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 class ArraySet : public SetInterface { private: /** Maximum capacity of this set. */ static const int DEFAULT_CAPACITY = 6;

/** 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 toVector() const; };

#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 class SetInterface { public: /** Virtual destructor. (See C++ Interlude 2.) */ virtual ~SetInterface() {}

/** 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 toVector() const = 0;

// virtual ArraySet difference (ArraySetset); };

#include "ArraySet.cpp"

#endif

ArraySet.cpp:21:13: error: expected initializer before k token int ArraySet::getCurrentSize() const { ArraySet.cpp:27:14: error: expected initializer before '::isEmpty() const {

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!