Class problem

I'm trying to create a class, that creates objects, that hold the information for three employees. I've made the specification file(.h), the implementation file (.cpp) and a different .cpp file for the main stuff. For whatever reason it will not boot up I just get an error. "is not recognized as an internal or external command". Can anyone please help me out??!!

Header File

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
<#ifndef EMPLOYEE_H
#define EMPLOYEE_H
#include <string>

using namespace std;
class Employee
{
	private:
	string name;
	int idNumber;
	string Department;
	string Position;
public:
	Employee(string, int, string, string);
	Employee(string, int);
	Employee();

	void setName(string);
	void setidNumber(int);
	void setDepartment(string);
	void setPosition(string);

	string getName() const;
	int getidNumber() const;
	string getDepartment() const;
	string getPosition() const;
};
#endif
>

Implementation file
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
#include "Employee.h"

Employee::Employee(string n, int id, string dept, string pos)
{
	name = n;
	idNumber = id;
	Department = dept;
	Position = pos;
}
Employee::Employee(string n, int id)
{
	name = n;
	idNumber = id;
	Department = " ";
	Position = " ";
}
Employee::Employee()
{
	name = " ";
	idNumber = 0;
	Department = " ";
	Position = " ";
}

void Employee::setName(string n)
{
	name = n;
}
void Employee::setidNumber(int id)
{
	idNumber = id;
}
void Employee::setDepartment(string dept)
{
	Department = dept;
}
void Employee::setPosition(string pos)
{
	Position = pos;
}
string Employee::getName() const
{
	return name;
}
int Employee::getidNumber() const
{
	return idNumber;
}
string Employee::getDepartment() const
{
	return Department;
}
string Employee::getPosition() const
{
	return Position;
}

and the main .cpp file
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
#include "Employee.h"
#include <iostream>
#include <string>
#include <iomanip>
using namespace std;

void displayEmployee(Employee);

int main()
{
		Employee susan("Susan Meyers",47899, "Accounting", "Vice President");
		Employee mark("Mark Jones", 39119);
		Employee joy;

		displayEmployee(susan);
		displayEmployee(mark);
		displayEmployee(joy);

		mark.setDepartment("IT");
		mark.setPosition("Programmer");

		joy.setName("Joy Rogers");
		joy.setidNumber(81774);
		joy.setDepartment("Manufacturing");
		joy.setPosition("Engineer");
	
	cout << "The following data shows info for each employee:" << endl;
	cout << "------------------------------------------------" << endl;
	displayEmployee(susan);
	displayEmployee(mark);
	displayEmployee(joy);

	return 0;
}

void displayEmployee(Employee e)
{
	cout << "------------------------------------" << endl;
	cout << e.getName() << endl;
	cout << e.getidNumber() << endl;
	cout << e.getDepartment() << endl;
	cout << e.getPosition() << endl;
}

Last edited on
Does it compile?

If it compiles, are you sure you're attempting to run it from the correct directory?

If it doesn't compile, what compilation errors are you getting?
Last edited on
Hey thanks for your response! I actually realized I had to right click the project and build the solution... It worked after that, took me awhile until I thought about what you said.
Topic archived. No new replies allowed.