Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

a. Complete the design and implementation of the class customerType defined in t

ID: 3631465 • Letter: A

Question

a. Complete the design and implementation of the class customerType defined in the programming example video store.
b. design and implement the class cutomerListType to create and maintain a list of customers for the video store

believe this question is also in C++ Programming chap 18 PE 14.

Thanks

Explanation / Answer

Dear Friend here is the files for the program PLEASE RATE 1)LINKEDLIST.H #ifndef H_LinkedListType #define H_LinkedListType #include #include using namespace std; template struct nodeType { Type info; nodeType *link; }; template class linkedListType { friend ostream& operatorinfo; //return the info of the first node }//end front template Type linkedListType::back() { assert(last != NULL); return last->info; //return the info of the first node }//end back template bool linkedListType::search(const Type& searchItem) { nodeType *current; //pointer to traverse the list bool found; current = first; //set current to point to the //first node in the list found = false; //set found to false while(current != NULL && !found) //search the list if(current->info == searchItem) //the item is found found = true; else current = current->link; //make current point //to the next node return found; }//end search template void linkedListType::insertFirst(const Type& newItem) { nodeType *newNode; //pointer to create the new node newNode = new nodeType; //create the new node assert(newNode != NULL); //If unable to allocate memory, //terminate the program newNode->info = newItem; //store the new item in the node newNode->link = first; //insert newNode before first first = newNode; //make first point to the //actual first node count++; //increment count if(last == NULL) //if the list was empty, newNode is also //the last node in the list last = newNode; } template void linkedListType::insertLast(const Type& newItem) { nodeType *newNode; //pointer to create the new node newNode = new nodeType; //create the new node assert(newNode != NULL); //If unable to allocate memory, //terminate the program newNode->info = newItem; //store the new item in the node newNode->link = NULL; //set the link field of newNode //to NULL if(first == NULL) //if the list is empty, newNode is //both the first and last node { first = newNode; last = newNode; count++; //increment count } else //the list is not empty, insert newNode after last { last->link = newNode; //insert newNode after last last = newNode; //make last point to the actual last node count++; //increment count } }//end insertLast template void linkedListType::deleteNode(const Type& deleteItem) { nodeType *current; //pointer to traverse the list nodeType *trailCurrent; //pointer just before current bool found; if(first == NULL) //Case 1; list is empty. cerrlink; count--; if(first == NULL) //list has only one node last = NULL; delete current; } else //search the list for the node with the given info { found = false; trailCurrent = first; //set trailCurrent to point to //the first node current = first->link; //set current to point to the //second node while(current != NULL && !found) { if(current->info != deleteItem) { trailCurrent = current; current = current->link; } else found = true; } // end while if(found) //Case 3; if found, delete the node { trailCurrent->link = current->link; count--; if(last == current) //node to be deleted was //the last node last = trailCurrent; //update the value of last delete current; //delete the node from the list } else coutlink = newNode; //attach newNode after last last = newNode; //make last point to //the actual last node current = current->link; //make current point to //the next node }//end while }//end else }//end copyList //copy constructor template linkedListType::linkedListType (const linkedListType& otherList) { first = NULL; copyList(otherList); }//end copy constructor //overload the assignment operator template const linkedListType& linkedListType::operator= (const linkedListType& otherList) { if(this != &otherList) //avoid self-copy copyList(otherList); return *this; } #endif 2) #ifndef H_VideoLinkedListType #define H_VideoLinkedListType #include #include #include "linkedList.h" #include "videoType.h" using namespace std; class videoListType: public linkedListType { public: bool videoSearch(string vTitle); //Function to search the list to see whether a //particular title, specified by the parameter title, //is in the store. //Postcondition: Returns true if the title is found; // otherwise, returns false. bool isVideoAvailable(string vTitle); //Function to return true if at least one copy of a //particular video is in the store. void videoCheckOut(string title); //Function to check out a video, that is, rent a video. //Postcondition: copiesInStock is decremented by one. void videoCheckIn(string vTitle); //Function to check in a video returned by a customer. //Postcondition: copiesInstock is incremented by one. bool videoCheckTitle(string vTitle); //Function to determine whether a particular video is in //the store. //Postcondition: Returns true if the video title is the // same as vTitle; otherwise, returns // false. void videoUpdateInStock(string vTitle, int num); //Function to update the number of copies of a video //by adding the value of the parameter num. The //parameter vTitle specifies the name of the video for //which the number of copies is to be updated. //Postcondition: copiesInStock = copiesInStock + num void videoSetCopiesInStock(string vTitle, int num); //Function to reset the number of copies of a video. //The parameter vTitle specifies the name of the video //for which the number of copies is to be reset; the //parameter num specifies the number of copies. //Postcondition: copiesInStock = num void videoPrintTitle(); //Function to print the titles of all the videos in the store. private: void searchVideoList(string vTitle, bool& found, nodeType* ¤t); //Function to searche the video list for a particular //video, specified by the parameter vTitle. //Postcondition: If the video is found, the parameter // found is set to true; otherwise, it is set // to false. The parameter current points to // the node containing the video. }; #endif 3) #include #include #include "videoLinkedListType.h" using namespace std; bool videoListType::isVideoAvailable(string vTitle) { bool found; nodeType *location; searchVideoList(vTitle, found, location); if(found) found = (location->info.getNoOfCopiesInStock() > 0); else found = false; return found; } void videoListType::videoCheckIn(string vTitle) { bool found = false; nodeType *location; searchVideoList(vTitle, found, location); if(found) location->info.checkIn(); else cout
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at drjack9650@gmail.com
Chat Now And Get Quote