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

Almost there... I have five errors that are porbably easy fixes. Here are the er

ID: 3560448 • Letter: A

Question

Almost there... I have five errors that are porbably easy fixes. Here are the errors...

#include <iostream>
#include <fstream>
#include <iomanip>

using namespace std;

class Employee_Info{
public:
   int employeeid;
   string firstname, lastname;
   char taxstatus, typeemployee;
   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(int i) = 0;
};//end class

void Employee::netpaysort(){
   for (int pass = 1; pass <= counter; pass = pass + 1) {
       for (int i = 0; i<counter - 1; i = i + 1) {
           if (empi[i].netpay<empi[i + 1].netpay) {
               swap(empi[i].netpay, empi[i + 1].netpay);
           }//end if
       }//end for
   }//end for
}//end netpaysort

class Hourly_Employee : public Employee{
public:
   Hourly_Employee();//constructor
   ~Hourly_Employee();//destructor

   void grosspaycalc(){
       for (int i = 0; i<counter; i++) {
           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; i<counter; i++) {

           if (empi[i].grosspay>1000) {
               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<counter; i++) {
           empi[i].taxamount = empi[i].grosspay*empi[i].taxrate;
           empi[i].netpay = empi[i].grosspay - empi[i].taxamount;
       }//end for
   }//end netpaycalc

   void displayinfo(int i){
       if (empi[i].typeemployee == 'N' || empi[i].typeemployee == 'n') {
           cout << setiosflags(ios::fixed | ios::showpoint | ios::left) << setprecision(2);
           cout << setw(15) << empi[i].employeeid << setw(15) << empi[i].firstname << setw(15) << empi[i].lastname << setw(15) << empi[i].taxstatus << setw(15) << empi[i].typeemployee << setw(15) << empi[i].hoursworked << "$ " << setw(15) << empi[i].hourlyrate << setw(15) << empi[i].grosspay << setw(15) << empi[i].overtimehours << "$ " << setw(17) << empi[i].overtimepay << "% " << setw(15) << empi[i].taxrate * 100 << "$ " << setw(15) << empi[i].taxamount << "$ " << setw(15) << empi[i].netpay << endl;
       }//end if
   }//end employeeinfo

   void employee_report(){
       grosspaycalc();
       taxratecalc();
       netpaycalc();
       netpaysort();
   }//end readindata
};//end class

Hourly_Employee::Hourly_Employee() :Employee(){

   input.open("data.txt");
   counter = 0;

   while (input >> empi[counter].employeeid >> empi[counter].firstname >> empi[counter].lastname >> empi[counter].taxstatus >> empi[counter].typeemployee
       >> empi[counter].hoursworked >> empi[counter].hourlyrate >> empi[counter].grosssalary) {
       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) << "The Payroll Program" << endl;
   headers();
   for (int i = 0; i<MAXSIZE; i++) {
       hourly_report.employee_report();
       hourly_report.displayinfo(i);
   }//end for
   return 0;
}// End Main

void headers(){
   cout << setiosflags(ios::fixed | ios::showpoint | ios::left);
   cout << setw(15) << "Employee ID" << setw(15) << "First Name" << setw(15) << "Last Name" << setw(22) << "Tax Amount" << setw(15) << "Net Pay" << endl;
}//end

Explanation / Answer

Its seems fine using gcc compiler....

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