Hello once again. I'm trying to do one last project, but unlike the others, that usually i struggle with some common errors, this time i have problems figuring out how its supposed to be created.
This is the question:
Write a class named Employee that has the following member variables:
name, idnumber, department, position
and have the following constructors.
-one that accepts values as arguments and assigns them to the appropiate member variables, employee name, employee id, department, position
-accepts the following values as arguments and assigns them to the appropiate member variables name, id. the department and position fields should be assigned and empty string ("")
-a default constructor that assigns empty strings ("") to the name, department, and position member variables and 0 to the idnumber member variable.
Write appropriate mutator functions that store values in these member variables. once you have written the class, write a separete program that creates three employee objects to hold the data :
" susan meyers, 47899, accounting, vice president"
"Mark jones, 39119, IT, programmer"
"Joy Rogers, 81774, manufacturing, Engineer"
The program should store this data in the three objects and then display the data for eac h employee on the screen
This is what i think could be included in the first program:
#include <iostream>
#include <string>
using namespace std;
class Employee
{
private:
string Name;
int IdNumber;
string Department;
string Position;
public:
Employee(string AssignName,int AssignIdNumber,string AssignDepartment,string AssignPosition)
{
Name=AssignName;
IdNumber=AssignIdNumber;
Department=AssignDepartment;
Position=AssignPosition;
}
Employee(string AssignName,int AssignIdNumber)
{
Name=AssignName;
IdNumber= AssignIdNumber;
Department="";
Position="";
}
Employee()
{
Name="";
IdNumber=0;
Department="";
Position="";
}
string getName() const;
int getIdNumber() const;
string getDepartment() const;
string getPosition () const;
};
string Employee::getName() const
{
return Name;
}
int Employee::getIdNumber() const
{
return IdNumber;
}
string Employee::getDepartment() const
{
return Department;
}
string Employee::getPosition() const
{
return Position;
}
The second part, the second program i think holds something like:
#include <iostream>
#include "EmployeeClass"
using namespace std;
int main()
{
Employee Name[3] ={ "Susan Meyer", "Mark Jones", "Joy Rogers"};
Employee Idnumber[3] ={ 47899, 39119,81774};
Employee Department[3] = { "Accounting", "IT", "Manufacturing"};
Employee Position[3] = {"Vice President", "Programmer", "Engineer"};
return 0;
}
As to how to have two separete programs combined to make one ???never done anything as advanced as this, PLEASE HELP.