Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

c++ Could somebody break down this code I'm about to post and explain it to me how it works. I understand parts but if their

c++

Could somebody break down this code I'm about to post and explain it to me how it works. I understand parts but if their is at all an ELI5(Explain like im 5) here I would really appreciate.

#include #include #include using namespace std; class Employee_Info{ public: int employeeid; string firstname, lastname; char taxstatus, typeemp; double hoursworked, hourlyrate, overtimehours, overtimepay, grosspay, grosssalary, taxrate, taxamount, netpay; };//end class class Employee :public Employee_Info{ public: ifstream input; Employee_Info empi[100]; int counter; void headers(); virtual void grosspaycalc() = 0; virtual void taxratecalc() = 0; virtual void netpaycalc() = 0; virtual void employee_report() = 0; void netpaysort(); virtual void displayinfo() = 0; };//end class void Employee::netpaysort(){ for (int pass = 1; pass <= counter; pass = pass + 1) { for (int i = 0; i40) { empi[i].overtimehours = empi[i].hoursworked - 40; empi[i].overtimepay = 1.5*empi[i].overtimehours*empi[i].hourlyrate; } else { empi[i].overtimehours = 0; empi[i].overtimepay = 0; } } else if (empi[i].hoursworked>40){ empi[i].overtimehours = empi[i].hoursworked - 40; empi[i].overtimepay = 1.5*empi[i].overtimehours*empi[i].hourlyrate; empi[i].grosspay = empi[i].overtimepay + (empi[i].hoursworked*empi[i].hourlyrate); }//end if else { empi[i].overtimehours = 0; empi[i].overtimepay = 0; empi[i].grosspay = empi[i].hoursworked*empi[i].hourlyrate; } }//end for }//end grosspaycalc void taxratecalc(){ for (int i = 0; i1000) { empi[i].taxrate = .30; }//end if if (empi[i].grosspay>800 && empi[i].grosspay <= 1000) { empi[i].taxrate = .20; }//end if if (empi[i].grosspay>500 && empi[i].grosspay <= 800) { empi[i].taxrate = .10; }//end if if (empi[i].grosspay >= 0 && empi[i].grosspay <= 500) { empi[i].taxrate = 0; }//end if if ((empi[i].taxstatus == 'H' || empi[i].taxstatus == 'h') && (empi[i].grosspay>500)){ empi[i].taxrate = empi[i].taxrate - .05; }//end if if (empi[i].taxstatus == 'S' || empi[i].taxstatus == 's'){ empi[i].taxrate = empi[i].taxrate + .05; }//end if if (empi[i].taxstatus == 'M' || empi[i].taxstatus == 'm'){ empi[i].taxrate = empi[i].taxrate; }//end if }//end for }//end Hourly_Employee taxratecalc void netpaycalc(){ for (int i = 0; i> empi[counter].firstname >> empi[counter].lastname >> empi[counter].employeeid >> empi[counter].taxstatus >> empi[counter].typeemp >> empi[counter].hoursworked >> empi[counter].hourlyrate >> empi[counter].grosspay) { counter++; }//end while }//end constructor Hourly_Employee::~Hourly_Employee(){ input.close(); }// end Destructor //end function void headers(); int main(int argc, char * argv[]){ const int MAXSIZE = 70; Hourly_Employee hourly_report; cout << setw(100) << "NOREEN Payroll Program" << endl; headers(); //for (int i = 0; i

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

Step: 3

blur-text-image

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

XML Data Management Native XML And XML Enabled Database Systems

Authors: Akmal Chaudhri, Awais Rashid, Roberto Zicari, John Fuller

1st Edition

0201844524, 978-0201844528

More Books

Students also viewed these Databases questions

Question

LO5 Describe job analysis and the stages in the process.

Answered: 1 week ago