The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | May 2017 |
| Last Sign in: | 398 Weeks Ago, 2 Days Ago |
| Questions Answered: | 66690 |
| Tutorials Posted: | 66688 |
MCS,PHD
Argosy University/ Phoniex University/
Nov-2005 - Oct-2011
Professor
Phoniex University
Oct-2001 - Nov-2016
C++ Programming assignment
Implement the following specification of UnsortedType using a circular linked list as the implementation structure.
Â
template <class ItemType>
struct NodeType;
Â
/* Assumption: ItemType is a type for which the operators
"<" and "==" are definedA????1either an appropriate built-in type or a class that overloads these operators. */
Â
template <class ItemType>
class UnsortedType
{
public:
// Class constructor, destructor, and copy constructor
UnsortedType();
~UnsortedType();
UnsortedType(const UnsortedType<ItemType>&);
Â
void operator=(UnsortedType<ItemType>);
Â
bool IsFull() const;
// Determines whether list is full.
// Post: Function value = (list is full)
Â
int GetLength() const;
// Determines the number of elements in list.
// Post: Function value = number of elements in list.
void RetrieveItem(ItemType& item, bool& found);
// Retrieves list element whose key matches item's key
// (if present).
// Pre: Key member of item is initialized.
// Post: If there is an element someItem whose key matches
//Â Â Â Â item's key, then found = true and item is a copy of
//Â Â Â Â someItem; otherwise found = false and item is
//Â Â Â Â unchanged.
//Â Â Â Â List is unchanged.
Â
Â
void InsertItem(ItemType item);
// Adds item to list.
// Pre: List is not full.
//Â Â Â Â Â Â item is not in list.
// Post: item is in list.
Â
void DeleteItem(ItemType item);
// Deletes the element whose key matches item's key.
// Pre: Key member of item is initialized.
//Â Â Â Â Â Â One and only one element in list has a key matching
//Â Â Â Â Â Â item's key.
// Post: No element in list has a key matching item's key.
Â
void ResetList();
// Initializes current position for an iteration through the
// list. Â
// Post: Current position is prior to list.
Â
void GetNextItem(ItemType&);
// Gets the next element in list.
// Pre: Current position is defined.
//Â Â Â Â Â Â Element at current position is not last in list.
// Post: Current position is updated to next position.
//Â Â Â Â Â Â item is a copy of element at current position.
Â
private:
NodeType<ItemType>* listData;
int length;
NodeType<ItemType>* currentPos;
};
Deliverables
A listing of the specification and implementation files for UnsortedType
A listing of the driver program for your test plan
A listing of the test plan as input to the driver.
A listing of the output from the driver.
Hel-----------lo -----------Sir-----------/Ma-----------dam-----------Tha-----------nk -----------You----------- fo-----------r u-----------sin-----------g o-----------ur -----------web-----------sit-----------e a-----------nd -----------and----------- ac-----------qui-----------sit-----------ion----------- of----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n.P-----------lea-----------se -----------pin-----------g m-----------e o-----------n c-----------hat----------- I -----------am -----------onl-----------ine----------- or----------- in-----------box----------- me----------- a -----------mes-----------sag-----------e I----------- wi-----------ll