SlideShare a Scribd company logo
1 of 10
Download to read offline
Pleae help me with this C++ task to the required result by edit or fixing, ill upvote thanks.
Unordered Sets |As explained in this chapter, a set is a collection of distinct elements of the same
type. Design the class unorderedSetType, derived from the class unorderedArrayListType, to
manipulate sets.
Note that you need to redefine only the functions insertAt, insertEnd, and replaceAt. If the item
to be inserted is already in the list, the functions insertAt and insertEnd output an appropriate
message, such as 13 is already in the set. Similarly, if the item to be replaced is already in the
list, the function replaceAt outputs an appropriate message. Also, write a program to test your
class.
main.cpp
//////////////////
unorderedArrayListTypeImp.cpp
#include
#include "unorderedArrayListType.h"
using namespace std;
void unorderedArrayListType::insertAt(int location,
int insertItem) {
if (location < 0 || location >= maxSize)
cout << "The position of the item to be inserted "
<< "is out of range." << endl;
else if (length >= maxSize) //list is full
cout << "Cannot insert in a full list" << endl;
else {
for (int i = length; i > location; i--)
list[i] = list[i - 1]; //move the elements down
list[location] = insertItem; //insert the item at
//the specified position
length++; //increment the length
}
} //end insertAt
void unorderedArrayListType::insertEnd(int insertItem) {
if (length >= maxSize) //the list is full
cout << "Cannot insert in a full list." << endl;
else {
list[length] = insertItem;
length++;
}
} //end insertEnd
int unorderedArrayListType::seqSearch(int searchItem) const {
int loc;
bool found = false;
loc = 0;
while (loc < length && !found)
if (list[loc] == searchItem)
found = true;
else
loc++;
if (found)
return loc;
else
return -1;
} //end seqSearch
void unorderedArrayListType::remove(int removeItem) {
int loc;
if (length == 0)
cout << "Cannot delete from an empty list." << endl;
else {
loc = seqSearch(removeItem);
if (loc != -1)
removeAt(loc);
else
cout << "The item to be deleted is not in the list."
<< endl;
}
}
void unorderedArrayListType::removeAll(int removeItem) {
int loc;
if (length == 0)
cout << "Cannot delete from an empty list." << endl;
else{
loc = seqSearch(removeItem);
if (loc != -1)
removeAt(loc);
else
cout << "The item to be deleted is not in the list." << endl;
}
// Set up a loop to find other occurrences and delete them as well
while (loc != -1)
{
loc = seqSearch(removeItem);
if (loc != -1)
removeAt(loc);
}
}
void unorderedArrayListType::replaceAt(int location, int repItem) {
if (location < 0 || location >= length)
cout << "The location of the item to be "
<< "replaced is out of range." << endl;
else
list[location] = repItem;
}
unorderedArrayListType::unorderedArrayListType(int size)
: arrayListType(size) {
}
////////////////////////
unorderedArrayListType.h
///////////////////
arrayListTypeImp.cpp
#include
#include "arrayListType.h"
using namespace std;
bool arrayListType::isEmpty() const {
return (length == 0);
}
bool arrayListType::isFull() const {
return (length == maxSize);
}
int arrayListType::listSize() const {
return length;
} //end listSize
int arrayListType::maxListSize() const {
return maxSize;
}
void arrayListType::print() const {
for (int i = 0; i < length; i++)
cout << list[i] << " ";
cout << endl;
}
bool arrayListType::isItemAtEqual(int location, int item) const {
if (location < 0 || location >= length) {
cout << "The location of the item to be removed "
<< "is out of range." << endl;
return false;
} else
return (list[location] == item);
}
void arrayListType::removeAt(int location) {
if (location < 0 || location >= length)
cout << "The location of the item to be removed "
<< "is out of range." << endl;
else {
for (int i = location; i < length - 1; i++)
list[i] = list[i + 1];
length--;
}
}
void arrayListType::retrieveAt(int location, int& retItem) const {
if (location < 0 || location >= length)
cout << "The location of the item to be retrieved is "
<< "out of range" << endl;
else
retItem = list[location];
}
void arrayListType::clearList() {
length = 0;
}
arrayListType::arrayListType(int size) {
if (size <= 0) {
cout << "The array size must be positive. Creating "
<< "an array of the size 100." << endl;
maxSize = 100;
} else
maxSize = size;
length = 0;
list = new int[maxSize];
}
arrayListType::~arrayListType() {
delete [] list;
}
arrayListType::arrayListType(const arrayListType& otherList) {
maxSize = otherList.maxSize;
length = otherList.length;
list = new int[maxSize]; //create the array
for (int j = 0; j < length; j++) //copy otherList
list[j] = otherList.list[j];
}
//////////////////////////////
arrayListType.h
////////////////
unorderedSetTypeImp.cpp
#include
#include "unorderedSetType.h"
using namespace std;
unorderedSetType::unorderedSetType(int size):unorderedArrayListType(size) {
}
void unorderedSetType::insertAt(int location, int insertItem) {
if(!isEmpty()) {
if(seqSearch(insertItem)!=-1) {
cout<<"The entered item is already present in the list set!."<

More Related Content

Similar to Pleae help me with this C++ task to the required result by edit or f.pdf

#ifndef LINKED_LIST_ #define LINKED_LIST_ templateclass It.pdf
 #ifndef LINKED_LIST_ #define LINKED_LIST_ templateclass It.pdf #ifndef LINKED_LIST_ #define LINKED_LIST_ templateclass It.pdf
#ifndef LINKED_LIST_ #define LINKED_LIST_ templateclass It.pdfangelsfashion1
 
C++ detyrat postim_slideshare
C++ detyrat postim_slideshareC++ detyrat postim_slideshare
C++ detyrat postim_slidesharetctal
 
ReversePoem.java ---------------------------------- public cl.pdf
ReversePoem.java ---------------------------------- public cl.pdfReversePoem.java ---------------------------------- public cl.pdf
ReversePoem.java ---------------------------------- public cl.pdfravikapoorindia
 
AnswerNote LinkedList.cpp is written and driver program main.cpp.pdf
AnswerNote LinkedList.cpp is written and driver program main.cpp.pdfAnswerNote LinkedList.cpp is written and driver program main.cpp.pdf
AnswerNote LinkedList.cpp is written and driver program main.cpp.pdfanwarsadath111
 
How do I declare the following constructors in my .h file Below.pdf
How do I declare the following constructors in my .h file Below.pdfHow do I declare the following constructors in my .h file Below.pdf
How do I declare the following constructors in my .h file Below.pdfConint29
 
CBSE Class XII Comp sc practical file
CBSE Class XII Comp sc practical fileCBSE Class XII Comp sc practical file
CBSE Class XII Comp sc practical filePranav Ghildiyal
 
Below is a given ArrayList class and Main class Your Dreams Our Mission/tuto...
Below is a given ArrayList class and Main class  Your Dreams Our Mission/tuto...Below is a given ArrayList class and Main class  Your Dreams Our Mission/tuto...
Below is a given ArrayList class and Main class Your Dreams Our Mission/tuto...davidwarner122
 
c++Write a program to test the selection sort algorithm for array-.pdf
c++Write a program to test the selection sort algorithm for array-.pdfc++Write a program to test the selection sort algorithm for array-.pdf
c++Write a program to test the selection sort algorithm for array-.pdfakpatra2000
 
Please add-modify the following to the original code using C# 1- Delet.docx
Please add-modify the following to the original code using C# 1- Delet.docxPlease add-modify the following to the original code using C# 1- Delet.docx
Please add-modify the following to the original code using C# 1- Delet.docxStewartt0kJohnstonh
 
lab08build.bat@echo offclsset DRIVE_LETTER=1s.docx
lab08build.bat@echo offclsset DRIVE_LETTER=1s.docxlab08build.bat@echo offclsset DRIVE_LETTER=1s.docx
lab08build.bat@echo offclsset DRIVE_LETTER=1s.docxDIPESH30
 
1- The design of a singly-linked list below is a picture of the functi (1).pdf
1- The design of a singly-linked list below is a picture of the functi (1).pdf1- The design of a singly-linked list below is a picture of the functi (1).pdf
1- The design of a singly-linked list below is a picture of the functi (1).pdfafgt2012
 
Implement the additional 5 methods as indicated in the LinkedList fi.pdf
Implement the additional 5 methods as indicated in the LinkedList fi.pdfImplement the additional 5 methods as indicated in the LinkedList fi.pdf
Implement the additional 5 methods as indicated in the LinkedList fi.pdffootstatus
 
Header file for an array-based implementation of the ADT bag. @f.pdf
 Header file for an array-based implementation of the ADT bag. @f.pdf Header file for an array-based implementation of the ADT bag. @f.pdf
Header file for an array-based implementation of the ADT bag. @f.pdfsudhirchourasia86
 
C++ Searching & Sorting5. Sort the following list using the select.pdf
C++ Searching & Sorting5. Sort the following list using the select.pdfC++ Searching & Sorting5. Sort the following list using the select.pdf
C++ Searching & Sorting5. Sort the following list using the select.pdfRahul04August
 
Write a class ArrayList that represents an array of integers. Init.pdf
Write a class ArrayList that represents an array of integers. Init.pdfWrite a class ArrayList that represents an array of integers. Init.pdf
Write a class ArrayList that represents an array of integers. Init.pdffootworld1
 
Given the following codepackage data1;import java.util.;p.pdf
Given the following codepackage data1;import java.util.;p.pdfGiven the following codepackage data1;import java.util.;p.pdf
Given the following codepackage data1;import java.util.;p.pdfillyasraja7
 
i am looking for help on the method AddSorted and the method Copy only.pdf
i am looking for help on the method AddSorted and the method Copy only.pdfi am looking for help on the method AddSorted and the method Copy only.pdf
i am looking for help on the method AddSorted and the method Copy only.pdfsonunotwani
 

Similar to Pleae help me with this C++ task to the required result by edit or f.pdf (20)

#ifndef LINKED_LIST_ #define LINKED_LIST_ templateclass It.pdf
 #ifndef LINKED_LIST_ #define LINKED_LIST_ templateclass It.pdf #ifndef LINKED_LIST_ #define LINKED_LIST_ templateclass It.pdf
#ifndef LINKED_LIST_ #define LINKED_LIST_ templateclass It.pdf
 
Arrays
ArraysArrays
Arrays
 
C++ detyrat postim_slideshare
C++ detyrat postim_slideshareC++ detyrat postim_slideshare
C++ detyrat postim_slideshare
 
ReversePoem.java ---------------------------------- public cl.pdf
ReversePoem.java ---------------------------------- public cl.pdfReversePoem.java ---------------------------------- public cl.pdf
ReversePoem.java ---------------------------------- public cl.pdf
 
AnswerNote LinkedList.cpp is written and driver program main.cpp.pdf
AnswerNote LinkedList.cpp is written and driver program main.cpp.pdfAnswerNote LinkedList.cpp is written and driver program main.cpp.pdf
AnswerNote LinkedList.cpp is written and driver program main.cpp.pdf
 
How do I declare the following constructors in my .h file Below.pdf
How do I declare the following constructors in my .h file Below.pdfHow do I declare the following constructors in my .h file Below.pdf
How do I declare the following constructors in my .h file Below.pdf
 
CBSE Class XII Comp sc practical file
CBSE Class XII Comp sc practical fileCBSE Class XII Comp sc practical file
CBSE Class XII Comp sc practical file
 
Below is a given ArrayList class and Main class Your Dreams Our Mission/tuto...
Below is a given ArrayList class and Main class  Your Dreams Our Mission/tuto...Below is a given ArrayList class and Main class  Your Dreams Our Mission/tuto...
Below is a given ArrayList class and Main class Your Dreams Our Mission/tuto...
 
week-16x
week-16xweek-16x
week-16x
 
c++Write a program to test the selection sort algorithm for array-.pdf
c++Write a program to test the selection sort algorithm for array-.pdfc++Write a program to test the selection sort algorithm for array-.pdf
c++Write a program to test the selection sort algorithm for array-.pdf
 
Please add-modify the following to the original code using C# 1- Delet.docx
Please add-modify the following to the original code using C# 1- Delet.docxPlease add-modify the following to the original code using C# 1- Delet.docx
Please add-modify the following to the original code using C# 1- Delet.docx
 
lab08build.bat@echo offclsset DRIVE_LETTER=1s.docx
lab08build.bat@echo offclsset DRIVE_LETTER=1s.docxlab08build.bat@echo offclsset DRIVE_LETTER=1s.docx
lab08build.bat@echo offclsset DRIVE_LETTER=1s.docx
 
강의자료7
강의자료7강의자료7
강의자료7
 
1- The design of a singly-linked list below is a picture of the functi (1).pdf
1- The design of a singly-linked list below is a picture of the functi (1).pdf1- The design of a singly-linked list below is a picture of the functi (1).pdf
1- The design of a singly-linked list below is a picture of the functi (1).pdf
 
Implement the additional 5 methods as indicated in the LinkedList fi.pdf
Implement the additional 5 methods as indicated in the LinkedList fi.pdfImplement the additional 5 methods as indicated in the LinkedList fi.pdf
Implement the additional 5 methods as indicated in the LinkedList fi.pdf
 
Header file for an array-based implementation of the ADT bag. @f.pdf
 Header file for an array-based implementation of the ADT bag. @f.pdf Header file for an array-based implementation of the ADT bag. @f.pdf
Header file for an array-based implementation of the ADT bag. @f.pdf
 
C++ Searching & Sorting5. Sort the following list using the select.pdf
C++ Searching & Sorting5. Sort the following list using the select.pdfC++ Searching & Sorting5. Sort the following list using the select.pdf
C++ Searching & Sorting5. Sort the following list using the select.pdf
 
Write a class ArrayList that represents an array of integers. Init.pdf
Write a class ArrayList that represents an array of integers. Init.pdfWrite a class ArrayList that represents an array of integers. Init.pdf
Write a class ArrayList that represents an array of integers. Init.pdf
 
Given the following codepackage data1;import java.util.;p.pdf
Given the following codepackage data1;import java.util.;p.pdfGiven the following codepackage data1;import java.util.;p.pdf
Given the following codepackage data1;import java.util.;p.pdf
 
i am looking for help on the method AddSorted and the method Copy only.pdf
i am looking for help on the method AddSorted and the method Copy only.pdfi am looking for help on the method AddSorted and the method Copy only.pdf
i am looking for help on the method AddSorted and the method Copy only.pdf
 

More from vinodagrawal6699

Please answer it as soon as possible Chapter 2- Part 2 Link Stat.pdf
Please answer it as soon as possible  Chapter 2- Part 2 Link Stat.pdfPlease answer it as soon as possible  Chapter 2- Part 2 Link Stat.pdf
Please answer it as soon as possible Chapter 2- Part 2 Link Stat.pdfvinodagrawal6699
 
Please answer in Arm assembly language The file palindrome.s conta.pdf
Please answer in Arm assembly language The file palindrome.s conta.pdfPlease answer in Arm assembly language The file palindrome.s conta.pdf
Please answer in Arm assembly language The file palindrome.s conta.pdfvinodagrawal6699
 
Please answer in Arm assembly languageThe file palindrome.s contai.pdf
Please answer in Arm assembly languageThe file palindrome.s contai.pdfPlease answer in Arm assembly languageThe file palindrome.s contai.pdf
Please answer in Arm assembly languageThe file palindrome.s contai.pdfvinodagrawal6699
 
please answer detail thank you 5 .Deontology and consequentialism .pdf
please answer detail thank you 5 .Deontology and consequentialism .pdfplease answer detail thank you 5 .Deontology and consequentialism .pdf
please answer detail thank you 5 .Deontology and consequentialism .pdfvinodagrawal6699
 
Please answer based on the requirements written in the photo.Pro.pdf
Please answer based on the requirements written in the photo.Pro.pdfPlease answer based on the requirements written in the photo.Pro.pdf
Please answer based on the requirements written in the photo.Pro.pdfvinodagrawal6699
 
Please answer based on the requirements written in the photo.Prepa.pdf
Please answer based on the requirements written in the photo.Prepa.pdfPlease answer based on the requirements written in the photo.Prepa.pdf
Please answer based on the requirements written in the photo.Prepa.pdfvinodagrawal6699
 
Playground Project PlanYou have been asked to create a project pla.pdf
Playground Project PlanYou have been asked to create a project pla.pdfPlayground Project PlanYou have been asked to create a project pla.pdf
Playground Project PlanYou have been asked to create a project pla.pdfvinodagrawal6699
 
Plasmids do all of the following EXCEPTO have their own initiation.pdf
Plasmids do all of the following EXCEPTO have their own initiation.pdfPlasmids do all of the following EXCEPTO have their own initiation.pdf
Plasmids do all of the following EXCEPTO have their own initiation.pdfvinodagrawal6699
 
plan de atenci�n de enfermer�a para Linda Pittmon, una paciente de 7.pdf
plan de atenci�n de enfermer�a para Linda Pittmon, una paciente de 7.pdfplan de atenci�n de enfermer�a para Linda Pittmon, una paciente de 7.pdf
plan de atenci�n de enfermer�a para Linda Pittmon, una paciente de 7.pdfvinodagrawal6699
 
Physicians� Hospital has the following balances on December 31, 2024.pdf
Physicians� Hospital has the following balances on December 31, 2024.pdfPhysicians� Hospital has the following balances on December 31, 2024.pdf
Physicians� Hospital has the following balances on December 31, 2024.pdfvinodagrawal6699
 
Peter arrend� un espacio de oficina comercial al arrendador sobre la.pdf
Peter arrend� un espacio de oficina comercial al arrendador sobre la.pdfPeter arrend� un espacio de oficina comercial al arrendador sobre la.pdf
Peter arrend� un espacio de oficina comercial al arrendador sobre la.pdfvinodagrawal6699
 
Philip Brickell, a forty-three-year-old employee of the London Under.pdf
Philip Brickell, a forty-three-year-old employee of the London Under.pdfPhilip Brickell, a forty-three-year-old employee of the London Under.pdf
Philip Brickell, a forty-three-year-old employee of the London Under.pdfvinodagrawal6699
 
Periferik tolerans, bariyer bakl i�in neden kritiktir A) Uygun .pdf
Periferik tolerans, bariyer bakl i�in neden kritiktir A) Uygun .pdfPeriferik tolerans, bariyer bakl i�in neden kritiktir A) Uygun .pdf
Periferik tolerans, bariyer bakl i�in neden kritiktir A) Uygun .pdfvinodagrawal6699
 
paypal i�in sorular Paypaln profili nedir Kullanm nasl.pdf
paypal i�in sorular Paypaln profili nedir Kullanm nasl.pdfpaypal i�in sorular Paypaln profili nedir Kullanm nasl.pdf
paypal i�in sorular Paypaln profili nedir Kullanm nasl.pdfvinodagrawal6699
 
Paul Casey se retir� de la Marina de los EE. UU. en 2013. Recibe una.pdf
Paul Casey se retir� de la Marina de los EE. UU. en 2013. Recibe una.pdfPaul Casey se retir� de la Marina de los EE. UU. en 2013. Recibe una.pdf
Paul Casey se retir� de la Marina de los EE. UU. en 2013. Recibe una.pdfvinodagrawal6699
 
Party Supply Inc. a calender year corporation, took a physical inven.pdf
Party Supply Inc. a calender year corporation, took a physical inven.pdfParty Supply Inc. a calender year corporation, took a physical inven.pdf
Party Supply Inc. a calender year corporation, took a physical inven.pdfvinodagrawal6699
 
Parte 1 �Cu�l es el capital contable total de la Entidad A con bas.pdf
Parte 1 �Cu�l es el capital contable total de la Entidad A con bas.pdfParte 1 �Cu�l es el capital contable total de la Entidad A con bas.pdf
Parte 1 �Cu�l es el capital contable total de la Entidad A con bas.pdfvinodagrawal6699
 
PART I Think about the best and worst companies you know. What is e.pdf
PART I Think about the best and worst companies you know. What is e.pdfPART I Think about the best and worst companies you know. What is e.pdf
PART I Think about the best and worst companies you know. What is e.pdfvinodagrawal6699
 
Part AToday, theUS dollaris trading at 4.60, compared to 4.20 ayea.pdf
Part AToday, theUS dollaris trading at 4.60, compared to 4.20 ayea.pdfPart AToday, theUS dollaris trading at 4.60, compared to 4.20 ayea.pdf
Part AToday, theUS dollaris trading at 4.60, compared to 4.20 ayea.pdfvinodagrawal6699
 
Parann d�ng�s� nedir Para d�ng�s�ne kimler katlyor Finansal bir il.pdf
Parann d�ng�s� nedir Para d�ng�s�ne kimler katlyor Finansal bir il.pdfParann d�ng�s� nedir Para d�ng�s�ne kimler katlyor Finansal bir il.pdf
Parann d�ng�s� nedir Para d�ng�s�ne kimler katlyor Finansal bir il.pdfvinodagrawal6699
 

More from vinodagrawal6699 (20)

Please answer it as soon as possible Chapter 2- Part 2 Link Stat.pdf
Please answer it as soon as possible  Chapter 2- Part 2 Link Stat.pdfPlease answer it as soon as possible  Chapter 2- Part 2 Link Stat.pdf
Please answer it as soon as possible Chapter 2- Part 2 Link Stat.pdf
 
Please answer in Arm assembly language The file palindrome.s conta.pdf
Please answer in Arm assembly language The file palindrome.s conta.pdfPlease answer in Arm assembly language The file palindrome.s conta.pdf
Please answer in Arm assembly language The file palindrome.s conta.pdf
 
Please answer in Arm assembly languageThe file palindrome.s contai.pdf
Please answer in Arm assembly languageThe file palindrome.s contai.pdfPlease answer in Arm assembly languageThe file palindrome.s contai.pdf
Please answer in Arm assembly languageThe file palindrome.s contai.pdf
 
please answer detail thank you 5 .Deontology and consequentialism .pdf
please answer detail thank you 5 .Deontology and consequentialism .pdfplease answer detail thank you 5 .Deontology and consequentialism .pdf
please answer detail thank you 5 .Deontology and consequentialism .pdf
 
Please answer based on the requirements written in the photo.Pro.pdf
Please answer based on the requirements written in the photo.Pro.pdfPlease answer based on the requirements written in the photo.Pro.pdf
Please answer based on the requirements written in the photo.Pro.pdf
 
Please answer based on the requirements written in the photo.Prepa.pdf
Please answer based on the requirements written in the photo.Prepa.pdfPlease answer based on the requirements written in the photo.Prepa.pdf
Please answer based on the requirements written in the photo.Prepa.pdf
 
Playground Project PlanYou have been asked to create a project pla.pdf
Playground Project PlanYou have been asked to create a project pla.pdfPlayground Project PlanYou have been asked to create a project pla.pdf
Playground Project PlanYou have been asked to create a project pla.pdf
 
Plasmids do all of the following EXCEPTO have their own initiation.pdf
Plasmids do all of the following EXCEPTO have their own initiation.pdfPlasmids do all of the following EXCEPTO have their own initiation.pdf
Plasmids do all of the following EXCEPTO have their own initiation.pdf
 
plan de atenci�n de enfermer�a para Linda Pittmon, una paciente de 7.pdf
plan de atenci�n de enfermer�a para Linda Pittmon, una paciente de 7.pdfplan de atenci�n de enfermer�a para Linda Pittmon, una paciente de 7.pdf
plan de atenci�n de enfermer�a para Linda Pittmon, una paciente de 7.pdf
 
Physicians� Hospital has the following balances on December 31, 2024.pdf
Physicians� Hospital has the following balances on December 31, 2024.pdfPhysicians� Hospital has the following balances on December 31, 2024.pdf
Physicians� Hospital has the following balances on December 31, 2024.pdf
 
Peter arrend� un espacio de oficina comercial al arrendador sobre la.pdf
Peter arrend� un espacio de oficina comercial al arrendador sobre la.pdfPeter arrend� un espacio de oficina comercial al arrendador sobre la.pdf
Peter arrend� un espacio de oficina comercial al arrendador sobre la.pdf
 
Philip Brickell, a forty-three-year-old employee of the London Under.pdf
Philip Brickell, a forty-three-year-old employee of the London Under.pdfPhilip Brickell, a forty-three-year-old employee of the London Under.pdf
Philip Brickell, a forty-three-year-old employee of the London Under.pdf
 
Periferik tolerans, bariyer bakl i�in neden kritiktir A) Uygun .pdf
Periferik tolerans, bariyer bakl i�in neden kritiktir A) Uygun .pdfPeriferik tolerans, bariyer bakl i�in neden kritiktir A) Uygun .pdf
Periferik tolerans, bariyer bakl i�in neden kritiktir A) Uygun .pdf
 
paypal i�in sorular Paypaln profili nedir Kullanm nasl.pdf
paypal i�in sorular Paypaln profili nedir Kullanm nasl.pdfpaypal i�in sorular Paypaln profili nedir Kullanm nasl.pdf
paypal i�in sorular Paypaln profili nedir Kullanm nasl.pdf
 
Paul Casey se retir� de la Marina de los EE. UU. en 2013. Recibe una.pdf
Paul Casey se retir� de la Marina de los EE. UU. en 2013. Recibe una.pdfPaul Casey se retir� de la Marina de los EE. UU. en 2013. Recibe una.pdf
Paul Casey se retir� de la Marina de los EE. UU. en 2013. Recibe una.pdf
 
Party Supply Inc. a calender year corporation, took a physical inven.pdf
Party Supply Inc. a calender year corporation, took a physical inven.pdfParty Supply Inc. a calender year corporation, took a physical inven.pdf
Party Supply Inc. a calender year corporation, took a physical inven.pdf
 
Parte 1 �Cu�l es el capital contable total de la Entidad A con bas.pdf
Parte 1 �Cu�l es el capital contable total de la Entidad A con bas.pdfParte 1 �Cu�l es el capital contable total de la Entidad A con bas.pdf
Parte 1 �Cu�l es el capital contable total de la Entidad A con bas.pdf
 
PART I Think about the best and worst companies you know. What is e.pdf
PART I Think about the best and worst companies you know. What is e.pdfPART I Think about the best and worst companies you know. What is e.pdf
PART I Think about the best and worst companies you know. What is e.pdf
 
Part AToday, theUS dollaris trading at 4.60, compared to 4.20 ayea.pdf
Part AToday, theUS dollaris trading at 4.60, compared to 4.20 ayea.pdfPart AToday, theUS dollaris trading at 4.60, compared to 4.20 ayea.pdf
Part AToday, theUS dollaris trading at 4.60, compared to 4.20 ayea.pdf
 
Parann d�ng�s� nedir Para d�ng�s�ne kimler katlyor Finansal bir il.pdf
Parann d�ng�s� nedir Para d�ng�s�ne kimler katlyor Finansal bir il.pdfParann d�ng�s� nedir Para d�ng�s�ne kimler katlyor Finansal bir il.pdf
Parann d�ng�s� nedir Para d�ng�s�ne kimler katlyor Finansal bir il.pdf
 

Recently uploaded

A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfchloefrazer622
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application ) Sakshi Ghasle
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 

Recently uploaded (20)

A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application )
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 

Pleae help me with this C++ task to the required result by edit or f.pdf

  • 1. Pleae help me with this C++ task to the required result by edit or fixing, ill upvote thanks. Unordered Sets |As explained in this chapter, a set is a collection of distinct elements of the same type. Design the class unorderedSetType, derived from the class unorderedArrayListType, to manipulate sets. Note that you need to redefine only the functions insertAt, insertEnd, and replaceAt. If the item to be inserted is already in the list, the functions insertAt and insertEnd output an appropriate message, such as 13 is already in the set. Similarly, if the item to be replaced is already in the list, the function replaceAt outputs an appropriate message. Also, write a program to test your class. main.cpp ////////////////// unorderedArrayListTypeImp.cpp #include #include "unorderedArrayListType.h" using namespace std; void unorderedArrayListType::insertAt(int location, int insertItem) { if (location < 0 || location >= maxSize) cout << "The position of the item to be inserted " << "is out of range." << endl; else if (length >= maxSize) //list is full cout << "Cannot insert in a full list" << endl; else {
  • 2. for (int i = length; i > location; i--) list[i] = list[i - 1]; //move the elements down list[location] = insertItem; //insert the item at //the specified position length++; //increment the length } } //end insertAt void unorderedArrayListType::insertEnd(int insertItem) { if (length >= maxSize) //the list is full cout << "Cannot insert in a full list." << endl; else { list[length] = insertItem; length++; } } //end insertEnd int unorderedArrayListType::seqSearch(int searchItem) const { int loc; bool found = false;
  • 3. loc = 0; while (loc < length && !found) if (list[loc] == searchItem) found = true; else loc++; if (found) return loc; else return -1; } //end seqSearch void unorderedArrayListType::remove(int removeItem) { int loc; if (length == 0) cout << "Cannot delete from an empty list." << endl; else { loc = seqSearch(removeItem); if (loc != -1)
  • 4. removeAt(loc); else cout << "The item to be deleted is not in the list." << endl; } } void unorderedArrayListType::removeAll(int removeItem) { int loc; if (length == 0) cout << "Cannot delete from an empty list." << endl; else{ loc = seqSearch(removeItem); if (loc != -1) removeAt(loc); else cout << "The item to be deleted is not in the list." << endl; }
  • 5. // Set up a loop to find other occurrences and delete them as well while (loc != -1) { loc = seqSearch(removeItem); if (loc != -1) removeAt(loc); } } void unorderedArrayListType::replaceAt(int location, int repItem) { if (location < 0 || location >= length) cout << "The location of the item to be " << "replaced is out of range." << endl; else list[location] = repItem; } unorderedArrayListType::unorderedArrayListType(int size) : arrayListType(size) { } ////////////////////////
  • 6. unorderedArrayListType.h /////////////////// arrayListTypeImp.cpp #include #include "arrayListType.h" using namespace std; bool arrayListType::isEmpty() const { return (length == 0); } bool arrayListType::isFull() const { return (length == maxSize); } int arrayListType::listSize() const { return length; } //end listSize int arrayListType::maxListSize() const { return maxSize; } void arrayListType::print() const { for (int i = 0; i < length; i++)
  • 7. cout << list[i] << " "; cout << endl; } bool arrayListType::isItemAtEqual(int location, int item) const { if (location < 0 || location >= length) { cout << "The location of the item to be removed " << "is out of range." << endl; return false; } else return (list[location] == item); } void arrayListType::removeAt(int location) { if (location < 0 || location >= length) cout << "The location of the item to be removed " << "is out of range." << endl; else { for (int i = location; i < length - 1; i++) list[i] = list[i + 1];
  • 8. length--; } } void arrayListType::retrieveAt(int location, int& retItem) const { if (location < 0 || location >= length) cout << "The location of the item to be retrieved is " << "out of range" << endl; else retItem = list[location]; } void arrayListType::clearList() { length = 0; } arrayListType::arrayListType(int size) { if (size <= 0) { cout << "The array size must be positive. Creating " << "an array of the size 100." << endl; maxSize = 100;
  • 9. } else maxSize = size; length = 0; list = new int[maxSize]; } arrayListType::~arrayListType() { delete [] list; } arrayListType::arrayListType(const arrayListType& otherList) { maxSize = otherList.maxSize; length = otherList.length; list = new int[maxSize]; //create the array for (int j = 0; j < length; j++) //copy otherList list[j] = otherList.list[j]; } ////////////////////////////// arrayListType.h //////////////// unorderedSetTypeImp.cpp #include
  • 10. #include "unorderedSetType.h" using namespace std; unorderedSetType::unorderedSetType(int size):unorderedArrayListType(size) { } void unorderedSetType::insertAt(int location, int insertItem) { if(!isEmpty()) { if(seqSearch(insertItem)!=-1) { cout<<"The entered item is already present in the list set!."<