Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I need this in C++ -------------------------------------------------------------

ID: 3603332 • Letter: I

Question

I need this in C++

--------------------------------------------------------------------------------------------------------

. h files

#ifndef COMDATA_H
#define COMDATA_H
const int THOSNDS=1000;
const int HUNDRDS=100;
const int TENS=10;
struct ComData
{
string zip;
string date;
string comName;
string city;
string state;
string street;
  
};


#endif /* COMDATA_H */

#ifndef EMPDATA_H
#define EMPDATA_H
struct EmpData
{
string empName;
float hrsWrkd;
float payRate;
};


#endif /* EMPDATA_H */

-----------------------------------------------------------------------------

MAIN PROGRAM

cout<<"Pay Checks"<<endl<<endl;
ComData company;
EmpData worker;
int size=0;
EmpData *worList;

//Input data on the company
cout<<"Please enter the necessary information to fill out a check."
<<endl;
cout<<"Which company is this payroll for?"<<endl;
getline (cin, company.comName);
cout<<"Enter the street address of company:"<<endl;
getline (cin, company.street);
cout<<"Enter the city:"<<endl;
getline(cin, company.city);
cout<<"Enter the state:"<<endl;
getline (cin, company.state);
cout<<"Enter company zipcode:"<<endl;
getline (cin, company.zip);
cout<<"Enter the date this payrole is to be paid:"<<endl;
getline (cin, company.date);

//Input first round of employee data.
//MUST enter data for at least one employee
cout<<"Enter the employee's name: "<<endl;
getline(cin, worker.empName);
cout<<"Enter the hours worked this week (Max of 80):"<<endl;
cin>>worker.hrsWrkd;
//validate data type and range
while (cin.fail() || worker.hrsWrkd>80 || worker.hrsWrkd<=0)
{ //validate data type and range
cout<<"Entry not valid! Enter a non-zero positive integer less than 80!"
<<endl;
cin.clear();
cin.ignore(256, ' ');
cin>>worker.hrsWrkd;
}
cout<<"Enter the rate of pay for this employee (Max of $133/hr) "
"(0 or less to exit):"<<endl;
cin>>worker.payRate;
//validate data type and range
while (cin.fail() || worker.payRate>133 || worker.payRate<=0)
{
cout<<"Entry not valid! Enter a non-zero positive integer of 133 or "
"less!"<<endl;
cin.clear();
cin.ignore(256, ' ');
cin>>worker.payRate;
}
size++;
while (worker.hrsWrkd >0 && worker.payRate>0)
{
prnChck(worker, company);
cout<<endl;
worList=addline(worList, worker, size);

//Repeat process until a check for $0 or less would be cut
cout<<"Enter the employee's name: "<<endl;
cin.ignore(256, ' ');
getline(cin, worker.empName);
cout<<"Enter the hours worked this week (Max of 80) (0 or less to exit)"
":"<<endl;
cin>>worker.hrsWrkd;
//validate range and data type
while (cin.fail() || worker.hrsWrkd>80)
{
cout<<"Entry not valid! Enter a non-zero positive integer less "
"than 80!"<<endl;
cin.clear();
cin.ignore(256, ' ');
cin>>worker.hrsWrkd;
}
cout<<"Enter the rate of pay for this employee (Max of $133/hr):"<<endl;
cin>>worker.payRate;
//validate range and data type
while (cin.fail() || worker.payRate>133)
{
cout<<"Entry not valid! Enter a non-zero positive integer of "
"133 or less!"<<endl;
cin.clear();
cin.ignore(256, ' ');
cin>>worker.payRate;
}
size++;
}
pEmpCon(worList, size);
delete [] worList;
}

---------------------------------------------------------------------------------------

Explanation / Answer

#ifndef COMDATA_H
#define COMDATA_H
const int THOSNDS=1000;
const int HUNDRDS=100;
const int TENS=10;
struct ComData
{
string zip;
string date;
string comName;
string city;
string state;
string street;
  
};


#endif /* COMDATA_H */

#ifndef EMPDATA_H
#define EMPDATA_H
struct EmpData
{
string empName;
float hrsWrkd;
float payRate;
};


#endif /* EMPDATA_H */

-----------------------------------------------------------------------------

MAIN PROGRAM

cout<<"Pay Checks"<<endl<<endl;
ComData company;
EmpData worker;
int size=0;
EmpData *worList;

//Input data on the company
cout<<"Please enter the necessary information to fill out a check."
<<endl;
cout<<"Which company is this payroll for?"<<endl;
getline (cin, company.comName);
cout<<"Enter the street address of company:"<<endl;
getline (cin, company.street);
cout<<"Enter the city:"<<endl;
getline(cin, company.city);
cout<<"Enter the state:"<<endl;
getline (cin, company.state);
cout<<"Enter company zipcode:"<<endl;
getline (cin, company.zip);
cout<<"Enter the date this payrole is to be paid:"<<endl;
getline (cin, company.date);

//Input first round of employee data.
//MUST enter data for at least one employee
cout<<"Enter the employee's name: "<<endl;
getline(cin, worker.empName);
cout<<"Enter the hours worked this week (Max of 80):"<<endl;
cin>>worker.hrsWrkd;
//validate data type and range
while (cin.fail() || worker.hrsWrkd>80 || worker.hrsWrkd<=0)
{ //validate data type and range
cout<<"Entry not valid! Enter a non-zero positive integer less than 80!"
<<endl;
cin.clear();
cin.ignore(256, ' ');
cin>>worker.hrsWrkd;
}
cout<<"Enter the rate of pay for this employee (Max of $133/hr) "
"(0 or less to exit):"<<endl;
cin>>worker.payRate;
//validate data type and range
while (cin.fail() || worker.payRate>133 || worker.payRate<=0)
{
cout<<"Entry not valid! Enter a non-zero positive integer of 133 or "
"less!"<<endl;
cin.clear();
cin.ignore(256, ' ');
cin>>worker.payRate;
}
size++;
while (worker.hrsWrkd >0 && worker.payRate>0)
{
prnChck(worker, company);
cout<<endl;
worList=addline(worList, worker, size);

//Repeat process until a check for $0 or less would be cut
cout<<"Enter the employee's name: "<<endl;
cin.ignore(256, ' ');
getline(cin, worker.empName);
cout<<"Enter the hours worked this week (Max of 80) (0 or less to exit)"
":"<<endl;
cin>>worker.hrsWrkd;
//validate range and data type
while (cin.fail() || worker.hrsWrkd>80)
{
cout<<"Entry not valid! Enter a non-zero positive integer less "
"than 80!"<<endl;
cin.clear();
cin.ignore(256, ' ');
cin>>worker.hrsWrkd;
}
cout<<"Enter the rate of pay for this employee (Max of $133/hr):"<<endl;
cin>>worker.payRate;
//validate range and data type
while (cin.fail() || worker.payRate>133)
{
cout<<"Entry not valid! Enter a non-zero positive integer of "
"133 or less!"<<endl;
cin.clear();
cin.ignore(256, ' ');
cin>>worker.payRate;
}
size++;
}
pEmpCon(worList, size);
delete [] worList;
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote