I try to pass variables to my employee class but I can't see to figure out why it isn't working. I was following along with a tutorial explaining how it works but did cover how to do with already declared variables. So what do take variables initialized in main and pass them employee so I can use function raise to calculate raise later in the code. Im writing this text to padd the word count so I can post it. How much padding does it what.
class Employee
{
private:
string name;
int yearjoined;
double monthlySalary;
public:
Employee()
{
name = " ";
yearjoined = 0;
monthlySalary = 0;
}
void raise(string workerName, int yearJoin, double salary);
Employee(string workerName, int yearJoin, double salary)
{
int yearsworked;
name = workerName;
yearjoined = yearJoin;
monthlySalary = salary;
cout << name;
cout << yearjoined;
cout << monthlySalary;
/*raise(monthlySalary);*/
}
void raise(double salary)
{
}
};
int main()
{
string userName;
int userStart;
double userSalary;
cout << "What is you name?";
cin >> userName;
cout << "What year did you join the company?";
cin >> userStart;
cout << "What is you monthly salary?";
cin >> userSalary;
Employee worker(string userName, int userStart, double userSalary);
worker(userName, userStart, userSalary);
}