The problem is in your "get" functions.
I think what you want is for them to be "Set' functions.
1 2 3 4
|
float EmployeeSalary::getHrlyWage(float HrlyWage)
{
return HrlyWage;
}
|
This code is a really not what you want to do.
You are passing in a variable (the parameter HrlyWage), and then you are returning HrlyWage immediately. Because of variable hiding, which is an issue of scope which you will need to read up on, this will return the parameter you passed in, and will not change the EmployeeSalary instance at all.
Instead what you want to do is this:
1 2 3 4
|
void EmployeeSalary::setHrlyWage(float newHrlyWage)
{
HrlyWage = newHrlyWage;
}
|
This function "sets" the value of HrlyWage in the instance of EmployeeSalary upon which it is called.
Your call in main, then changes to:
You will have to make a few more similar changes throughout the code -- hopefully this'll get you on your way though.
Edit --
Oh, and the reason that you are getting a crazy value is because neither of Hrs, HrlyWage are properly instantiated, they are set to some random value. If you initialized the values to zero in your default constructor (the one with no parameters), then you would get it printing 0.00 as your salary value.