Dynamic string array

I need to create a dynamic array for an Employee class. The array must be of the employee names. I have nothing on my main yet because I'm still very confused.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
  Employee.h
#pragma once
#include<iostream>


using namespace std; 

class Employee
{

private:
	string name;
	int idNumber;
	string department;
	string position; 
	
public:
	//Constructores
	Employee(string name, int idNumber, string department, string position); 
	Employee(string name, int idNumber); 
	//Default contructor
	Employee();
	//Destructor
	~Employee();

	//Mutator set
	void setName(string);
	void setIdNumber(int);
	void setDepartment(string);
	void setPosition(string); 

	//Mutator get
	string getName() const; 
	int getIdNumber() const; 
	string getDepartment() const; 
	string getPosition()const; 

};



Employee.cpp

#include "Employee.h"
#include<iostream>
using namespace std; 




Employee::Employee()
{

}

//Constructor 1
Employee::Employee(string newName, int newIdNumber, string newDepartment, string newPosition)
{
	name = newName;
	idNumber = newIdNumber;
	department = newDepartment;
	position = newPosition; 
}

//Constructor 2
Employee::Employee(string newName, int newIdNumber)
{
	name = newName;
	idNumber = newIdNumber;
	department = "";
	position = "";
}

//Mutator functions: Set
void Employee::setName(string newName)
{
	name = newName;
}

void Employee::setIdNumber(int newIdNumber)
{
	idNumber = newIdNumber;
}

void Employee::setDepartment(string newDepartment)
{
	department = newDepartment; 
}

void Employee::setPosition(string newPosition)
{
	position = newPosition;
}

//Mutator functions: Get
string Employee::getName() const
{
	return name; 
}

int Employee::getIdNumber() const
{
	return idNumber;
}

string Employee::getDepartment() const
{
	return department;
}

string Employee::getPosition() const
{
	return position; 
}
Employee::~Employee()
{
}



main.cpp
#include<iostream>
#include"Employee.h"
#include<iomanip>



using namespace std;

int main()
{



	
	return 0; 
}
need to create a dynamic array for an Employee class.
Have you thought about how you might want to use it?

Try writing some code using it, then you can decide see methods it must support, then you can implement them.
I have implemented a few types of string arrays but they don't do what I expect. The professor wasn't that specific neither. I suppose its an array that asks the name of the employee and shows their iDnumber, department and position. I THINK that's what she want.
Last edited on
Topic archived. No new replies allowed.