Question: ItemType.h // SPECIFICATION FILE ItemType.h #ifndef ITEMTYPE_H #define ITEMTYPE_H #include using namespace std; const int MAX_ITEM = 5; enum RelationType { LESS, EQUAL, GREATER };

ItemType.h // SPECIFICATION FILE ItemType.h #ifndef ITEMTYPE_H #define ITEMTYPE_H #include using namespacestd; const int MAX_ITEM = 5; enum RelationType { LESS, EQUAL, GREATERItemType.h

// SPECIFICATION FILE ItemType.h #ifndef ITEMTYPE_H #define ITEMTYPE_H #include  using namespace std; const int MAX_ITEM = 5; enum RelationType { LESS, EQUAL, GREATER }; class ItemType // declares class data type { public : // 4 public member functions ItemType() {} RelationType ComparedTo( ItemType otherItem ) const { if ( value  otherItem.value ) return GREATER; else return EQUAL; } void Print( ) const { cout value = value; } private : // 1 private data member char value; // could be any type } ; #endif 

UnsortedListByArray.h

#ifndef UNSORTEDLISTBYARRAY_H #define UNSORTEDLISTBYARRAY_H #include "ItemType.h" class UnsortedListByArray // declares a class data type { public : UnsortedListByArray(); void MakeEmpty( ); // 8 public member functions void InsertItem( ItemType item ); void DeleteItem( ItemType item ); bool IsFull( ) const; bool IsEmpty( ) const; int GetLength( ) const; // returns length of list void RetrieveItem( ItemType & item, bool& found ); void ResetList( ); void GetNextItem( ItemType& item ); protected : int length; ItemType info[MAX_ITEM]; int currentPos; }; #endif

UnsortedListByArray.cpp

#include "UnsortedListByArray.h" UnsortedListByArray::UnsortedListByArray() { length = 0; } bool UnsortedListByArray::IsFull() const { return (length == MAX_ITEM); } int UnsortedListByArray::GetLength( ) const { return length; } bool UnsortedListByArray::IsEmpty() const { return (length == 0); } void UnsortedListByArray::InsertItem(ItemType item) // Post: item is in the list. { info[length] = item; length++; } void UnsortedListByArray::RetrieveItem(ItemType& item, bool& found) // Pre: Key member(s) of item is initialized. // Post: If found, item's key matches an element's key in the // list and a copy of that element has been stored in item; // otherwise, item is unchanged. { bool moreToSearch; int location = 0; found = false; moreToSearch = (location  

}; class ItemType // declares class data type { public : //

Your assignment is to extend an UnsortedType Abstract Data Type, which is implemented with an array. You are required to extend the implementation files ItemType.h, UnsortedListByArray.h, UnsortedListByArray.cpp to finish this project. And you need to write a test driver Lab1.cpp to test your extended ADT. In this project, please compare two strings as C++ builtin function does. Keep all functions we have discussed in class, additional functions should be added: bool NewInsertItem ( ItemType newItem) Example: Case A: Before inserting "Book", UnsortedListByArray list L : After inserting "Book", UnsortedListByArray list L: Case B: Before inserting "Book", UnsortedListByArray list L: After inserting "Book", UnsortedListByArray list L: void DeleteAllItems ( ItemType item ) Example: Before deleting "Book", UnsortedType list L: After deleting "Book", UnsortedType list L: void SplitList(ItemType item, UnsortedListByArray \& listOne, UnsortedListByArray \& listTwo) Example: Before split, UnsortedListByArray list L: If ItemType item's key is "H", after split we got UnsortedListByArray listOne UnsortedListByArray listTwo >./a.out Please type a sequence of strings with a word repeated at least three times, please use white space as the delimiter: This is a is is You typed: This is a is is Call the old insert item function: The listed created: This is a is is Call the old DeleteItem function: After delete the repeated word This is a is Call the new DeleteAllitems function: After delete all repeated words This a Call the new insert item function to insert all words into a new list again: The listed created: This is a The long list is This a Hat oK Split with J After split with item : J list one is : Hat list two is : This a oK This a Hat oK

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!