Question: #include #include #include using namespace std; int main ( ) { / / declare and populate the arrays to hold the first two columns of

#include
#include
#include
using namespace std;
int main()
{
//declare and populate the arrays to hold the first two columns of table
// Name and ID column
string name []=
{
"Bill Smith",
"Sally Mae",
"Tom Williams",
"John Cook",
"Bill Joy",
"Sue Bach",
"Pam Little"
};
int id[]=
{
5658845,
8451277,
4520125,
1302850,
7895122,
7580489,
8777541
};
const int SIZE =7;
int hours[SIZE];
double payRate[SIZE];
// Data input for hours and payRate arrays
for (int i =0; i < SIZE; i++)
{
cout << name[i]<<"("<< id[i]<<")"<> hours[i];
// input validation, check for negative numbers
while (hours[i]<0)
{
cout << "Error: "<< hours[i]<<"is negative." << endl;
cout << "Please enter a positive value." << endl;
cout << "Enter hours worked (eg,40): ";
cin >> hours[i];
}
cout << "Enter pay per hour (eg,10.10): ";
cin >> payRate[i];
// input validation, check for values less than NC min wage
const double NC_MIN_WAGE =7.50;
while (payRate[i]< NC_MIN_WAGE)
{
cout << "Error: "<< payRate[i]<<"is less than NC_MIN_WAGE." << endl;
cout <<"NC_MIN_WAGE is "<< NC_MIN_WAGE << endl;
cout << "Please enter a value greater than the min wage." << endl;
cout << "Enter pay per hour (eg,10.10): ";
cin >> payRate[i];
}
}
// Display pay
cout << fixed << showpoint << setprecision(2);
cout << "Gross Pay" << endl <<".................."<< endl;
for (int i=0; i < SIZE; i++)
{
double pay = hours[i]* payRate[i];
// overtime needed for 40+ hours
if(hours[i]>40)
pay = hours[i]* payRate[i]+(hours[i]-40)*1.5*payRate[i];
// Display payRate
cout << name[i]<<"("<< id[i]<<"): $"<< pay << endl;
}
return 0;
}
I am needing the program to calculate time and a half.
Bill Smith 565884510 hr $25 per hr
Sally Mae 845127722hr $12 per hr
Tom Williams 452012540hr $10 per hr
John Cook 130285044hr $12 per hr
Bill Joy 789512248hr $10.10 per hr
Sue Bach 758048935hr $15 per hr
Pam Little 877754140hr $12 per hr

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!