Hey Guys,
I am having a problem getting this program to work, can you help? It needs to return the values of the array to show which employees have made what amounts within the certain guidelines. Having trouble figuring out how array should be declared and written. Thanks.
Code:
//This program computes the amount of employees who receive a salary in a
set number of ranges.
//Assignment 4.10
#include <iostream>
#include <iomanip>
#include <conio.h>
using std::cout;
using std::cin;
int pay[];
double calculateSalary (double totalEarned){
// regular earning of each employee
double basesalary = 200;
// total amount employee brings to company
double earnings(totalEarned);
// percentage of amount employee receives as commision
double commision(earnings * .09);
// total amount employee earns with commision
double totalearned=(commision + basesalary);
return totalearned;
}
int main() //begins program execution
{
double earnings(0);
double totalEarned=0;
while (earnings =! -1)
cout << "Enter total sales for employee (Enter -1 to stop and tabulate) :";
cin >> earnings;
cout << "\nHere is the total salary of employee: $" <<
calculateSalary(earnings);
}
int pay[7]
{
switch (earnings)
case < 300 :
pay[0] = pay[0] + 1;
break;
case (< 400) (>= 300):
pay[1] = pay[1] + 1;
break;
case (< 500) (>=400):
pay[2] = pay[2] + 1;
break;
case (<600) (>=500):
pay[3] = pay[3] + 1;
break;
case (<700) (>=600):
pay[4] = pay[4] + 1;
break;
case (<800) (>=700):
pay[5] = pay[5] + 1;
break;
case (<900) (>=800):
pay[6] = pay[6] + 1;
break;
case (<1000) (>=900):
pay[7] = pay[7] + 1;
break;
}