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

In C++ demonstrate how to complete the following program. Please explain how you

ID: 3748248 • Letter: I

Question

In C++ demonstrate how to complete the following program. Please explain how you did this in detail.

Do not change anything in the supplied Ch12_Ex9.cpp except to add documentation and your name.

Please use the file names listed below since your file will have the following components:
Ch12_Ex9.cpp given file

//Data: 18 42 78 22 42 5 42 57

#include <iostream>
#include "unorderedArrayListType.h"

using namespace std;

int main()
{
unorderedArrayListType intList(25);

    int number;

    cout << "Enter 8 integers: ";

    for (int count = 0; count < 8; count++)
{
cin >> number;
intList.insertEnd(number);
}

    cout << endl;
cout << "intList: ";
intList.print();
cout << endl;

    cout << "The smallest number in intList: "
<< intList.min() << endl;
system("pause");
return 0;
}

arrayListType.h
arrayListType.Imp.cpp
unorderedArrayListType.h
unorderedArrayListTypeImp.cpp

Add the function min as an abstract function to the class arrayListType to return the smallest element of the list.

Also, write the definition of the function min in the class unorderedArrayListType and write a program to test this function.

Explanation / Answer

C++ CODE:


#include <iostream>
#include "unorderedArrayListType.h"
using namespace std;
int main()
{
unorderedArrayListType intList(25);
int number;
cout << "Enter 8 integers: ";
for (int count = 0; count < 8; count++)
{
cin >> number;
intList.insertEnd(number);
}
cout << endl;
cout << "intList: ";
intList.print();
cout << endl;
cout << "The smallest number in intList: "
<< intList.min() << endl;
system("pause");
return 0;
}
unorderedArrayListType.h
#include <string>
#include <iostream>
using namespace std;
#include "arrayListType.h"
class unorderedArrayListType : arrayListType
{
public:
int arr[10], i;
unorderedArrayListType(int n)
{
i = 0;
}
void insertEnd(int n)
{
arr[i] = n;
i++;
}
int min()
{
int min = arr[0];
int j;
for (j = 0;j<i;j++)
{
if (arr[j]<min)
{
min = arr[j];
}
}
return min;
}
void print()
{
for (int j = 0;j<i;j++)
cout << arr[j] << endl;
}
};
arrayListType.h
#include <string>
#include <iostream>
using namespace std;
class arrayListType
{
public:
int min();
};
arrayListType.imp.cpp
#include <string>
#include <iostream>
using namespace std;
#include "arrayListType.h"
unorderedArrayListTypeimp.cpp
#include <string>
#include <iostream>
#include "unorderedArrayListType.h"
#include "arrayListType.h"
using namespace std;
class unorderedArrayListTypeimp
{
void min(int);
void print();
};