Hello,
I am having the following problem with calling my function to return the salary it calculated depending on the switch statement.
I don't understand the error:
": error C3861: 'getSalary': identifier not found"
double Salary::getSalary()
{
return salary;
}
void Salary::compute()
{
cout << "Enter the employee's paycode (-1 to end): ";
cin >> paycode;
validatePayCode(paycode);
while(paycode != -1)
{
switch (paycode)
{
case 1:
int fixed;
cout << "Enter the manager's weekly salary: ";
cin >> fixed;
validateDouble(fixed);
salary = fixed;
break;
case 2:
double hours;
cout << "Enter hours worked: ";
cin >> hours;
validateDouble(hours);
double wage;
cout << "Enter the hourly wage: ";
cin >> wage;
validateDouble(wage);
if(hours <= 40)
salary = hours * wage;
else
salary = 40 * wage + (hours - 40) * (wage + (wage/2));
break;
case 3:
int sales;
cout << "Enter the commission worker's gross weekly sales: ";
cin >> sales;
validateDouble(sales);
salary = 250 + .057 * sales;
break;
case 4:
int items;
cout << "Enter the number of items produced by the piece worker: ";
cin >> items;
validateInteger(items);
cout << "Enter the fixed amount per item: ";
cin >> fixed;
validateDouble(fixed);
salary = fixed * items;
break;
} // end switch
} // end while
displayMessage();
} // end compute function
void displayMessage()
{
cout << "The salary is $" << getSalary() << endl;
}