Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write the implementation of the removeltemAtIndex() member function. Before removing the item, first check that the index being asked to be removed is valid, for
- Write the implementation of the removeltemAtIndex() member function. Before removing the item, first check that the index being asked to be removed is valid, for example that it is not bigger than the size of the listTo remove the item, simply shift down all items above the index by 1 location, thus removing the indicated item and not leaving a hole in the items array. Don't forget to update the number of items after you finish removing the item.
- Write the implementation of the isEmpty () member function declared on line 19 of the class. The list is empty if there are no items currently stored in the list.
- Write the implementation of the isFulll function declared on line 20 of the class. The list is full when the number of items in the list is equal to the MAX_ITEMS constant declared in the ListType.
- Write the implementation of the finditem() member function. This function should search the current list of items and return true if the asked for item is currently in the list, and if the search fails to find the item on the current list.
#include
using namespace std;
1 2 3 4 5 6 7 8 9 10 11 12
class ListType
{
private:
const int MAX TEMS=20;
int numitems ;
string items;
public :
ListType();
ListType( int numItems, string initItems[]);
ListType();
bool isEmpty () const;
bool isFull () const ;
int getNumitems () const;
string getItemAtIndex( int index ) const;
void appendItem ( string newItem );
bool findItem (string searchItem ) const;
void replaceItemAtIndex (int index, string new int]
void removeItemAtIndex( int index);
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started