Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

#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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2018 Dublin Ireland September 10 14 2018 Proceedings Part 1 Lnai 11051

Authors: Michele Berlingerio ,Francesco Bonchi ,Thomas Gartner ,Neil Hurley ,Georgiana Ifrim

1st Edition

3030109240, 978-3030109240

More Books

Students also viewed these Databases questions

Question

Compose the six common types of social business messages.

Answered: 1 week ago

Question

Describe positive and neutral messages.

Answered: 1 week ago