1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103
|
//Global definitions
const int hours = 3;
const int staff = 10;
int payArray[staff] = {0,0,0,0,0,0,0,0,0,0};
string artists[staff] ={"Amy","David","John","Helen","Mumu","William","Sunny","Rocky","Benny","Dawn"};
int staffHours[staff][hours] = {{0,0,0},
{0,0,0},
{0,0,0},
{0,0,0},
{0,0,0},
{0,0,0},
{0,0,0},
{0,0,0},
{0,0,0},
{0,0,0}};
//Functions
void showMenu();
int enterPay(int staffHours[][hours],int);
int showPay(int[][hours],int);
void maxPay (int payArray[], int);
void checkout();
//MENU CASES
case MENU_TWO:
showPay(staffHours,staff);
break;
case MENU_THREE:
maxPay(payArray,staff);
break;
//SHOW PAY FUNCTION
int showPay(int[][hours],int staff)
{
int totalStaffHours;
double totalStaffPay;
double allPay =0;
double averagePay =0;
int belowAverage =0;
int aboveAverage =0;
cout << fixed << showpoint << setprecision(2);
cout << "\n\n";
cout << "===================================\n";
cout << "Pay Report: \n";
cout << setw(12) << "\t\t";
cout << setw(10) << "Hours \n";
for (int x=0; x < staff; x++)
{
//To refresh the totalStaff Hours & Pay count
totalStaffHours = 0;
totalStaffPay =0.0;
for (int y=0; y < hours; y++)
{
totalStaffHours += staffHours[x][y];
}
if (totalStaffHours <=30)
{
totalStaffPay = payArray[x] = totalStaffHours *10.0;
}
else
{
totalStaffPay = payArray[x] = 30*10.0 + (totalStaffHours - 30) * 10.0 * 1.5;
}
cout << setw(12) << artists[x] << "= $" << totalStaffPay ;
cout << setw (10) << "\t" << totalStaffHours;
//MAX PAY FUNCTION
void maxPay(int payArray[],int staff)
{
double highest;
string highestArtist;
for(int l=0;l<staff;l++)
{
cout << artists[l] << "\t" << payArray[l] << endl;
}
cout << "\n\n";
}
|