Need help to start Vector Program

Here is what we were assigned. I have no idea how to start this program. Any help would be great.
Here is the assignment:

Write a program that implements the Vector code written in class as a user-defined data-type (class). Vectors should….

a. Have private variables vect(int *), growth (int), maxSize(int)

b. Have a class constructor that allows the user to specify the initial values needed for the vector to work (initial array size and growth factor).

c. Have a public addItem method that allows the user to add elements to the vector.

d. Have a public deleteItem method that allows the user to delete items from the top of the vector.

e. Have a private resize function that executes when the vector reaches full capacity. The resize function should print a message to the screen each time it’s called.

f. Have a public printItems function that display just the top element of the vector class, along with the current size and the current maximum size.


3. Inside of main, use the following code to test your Vector class.

a. Create a new instance of type vector with a growth of 5 and a max-size of 10.
b. Use a random number generator to insert 5 random elements into the vector.
c. Print the contents of the vector.
d. Use deleteItems twice.
e. Add 9 more random elements
f. Print the contents of the vector.

Here is the code we have done in class. Where do I begin to change anything?
I am very shy at my school and its hard to find assistance to help in these projects. Any help I can get is greatly appreciated.
#include <iostream>
#include <string>
using namespace std;
class student
{
public:

void addClass(string title, int credits, char grade);
void printClasses(void);
float calcGPA(void);
student(int num_of_classes);

~student(void);


private:
bool isInitialized;
int numClasses;
int classesEntered;
char * gradesList;
string * titleList;
int * creditList;


};


student::~student(void)
{
delete [] gradesList;

delete [] titleList;

delete [] creditList;

cout << "Destructor was called!" << endl;
}


student::student(int num_of_classes)
{
numClasses = num_of_classes;
gradesList = new char[num_of_classes];
titleList = new string[num_of_classes];
creditList = new int[num_of_classes];
isInitialized = true;
classesEntered = 0;
cout << "Class constuctor was called!" << endl;
}

void student::addClass(string title, int credits, char grade)
{
if(isInitialized && classesEntered < numClasses)
{
titleList[classesEntered] = title;
creditList[classesEntered] = credits;
gradesList[classesEntered] = grade;
classesEntered++;
}
}

float student::calcGPA(void)
{
int creditTotal=0;
float qpTotal=0;
if(classesEntered!=0)
{
for(int i=0;i<classesEntered;i++)
{
if(gradesList[i]=='A')
{
qpTotal = qpTotal + (4.0 * (float)creditList[i]);
}
else if(gradesList[i]=='B')
{
qpTotal = qpTotal + (3.0 * (float)creditList[i]);
}
else if(gradesList[i]=='C')
{
qpTotal = qpTotal + (2.0 * (float)creditList[i]);
}
else if(gradesList[i]=='D')
{
qpTotal = qpTotal + (1.0 * (float)creditList[i]);
}
creditTotal+=creditList[i];
}
return qpTotal / (float)creditTotal;
}
else
{
return 0.0;
}

}



void student::printClasses(void)
{
if(isInitialized)
{
for(int i=0;i<classesEntered;i++)
{
cout << titleList[i] << "\t" << creditList[i] << "\t" << gradesList[i] << endl;
}
}
}

void main(void)
{
//string str;


student * s = new student(10);

//str = "Hello";
//cout << str.length << endl;


s->addClass("CSIT 121", 3, 'A');
s->addClass("CSIT 221", 3, 'B');
s->addClass("CSIT 224", 4, 'C');
s->addClass("CSIT 321", 3, 'A');

s->printClasses();
cout << "GPA: " << s->calcGPA() << endl;

delete s;


system("pause");
}

Write a program that implements the Vector code written in class as a user-defined data-type (class).
I can't see a Vector in anything you've written. It has nothing to do with your Student class.
Topic archived. No new replies allowed.