Question: /* Program to determine merit increases for faculty members */ #include #include using namespace std; double getInfo(); double calcIncrease(char, double); void printResult(char, double, double); int
/* Program to determine merit increases for faculty members */
#include
#include
using namespace std;
double getInfo();
double calcIncrease(char, double);
void printResult(char, double, double);
int main ()
{
char performanceRating;
double salary, newSalary;
salary = getInfo(&performanceRating);
newSalary = calcIncrease(performanceRating, salary);
printResult(performanceRating, salary, newSalary);
return 0;
}
// function to get the faculty performance rating and salary
double getInfo(char *performanceRating)
{
double salary;
cout << "Please enter the faculty performance rating (S - Superior, G - Good, A - Average): ";
cin >> *performanceRating;
// validate the performance rating
while (*performanceRating != 'S' && *performanceRating != 'G' && *performanceRating != 'A')
{
cout << "Error! Please enter the faculty performance rating (S - Superior, G - Good, A - Average): ";
cin >> *performanceRating;
}
cout << "Please enter the faculty salary: ";
cin >> salary;
return salary;
}
// function to calculate the salary increase based on the performance rating
double calcIncrease(char performanceRating, double salary)
{
double increase;
if (performanceRating == 'S')
increase = salary * 0.045;
else if (performanceRating == 'G')
increase = salary * 0.025;
else
increase = 0;
return salary + increase;
}
// function to print the performance rating, salary, and new salary
void printResult(char performanceRating, double salary, double newSalary)
{
cout << fixed << showpoint << setprecision(2) << endl;
cout << "Performance Rating: ";
if (performanceRating == 'S')
cout << "Superior" << endl;
else if (performanceRating == 'G')
cout << "Good" << endl;
else
cout << "Average" << endl;
cout << "Salary: $" << salary << endl;
cout << "New Salary: $" << newSalary << endl;
}
Does not compile correctly and when I get to compile does not ask for input. Does not work. Please explain why and how to fix.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
