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

CASE STUDY – PAYROLL SYSTEM PHASE 5: ARRAY The purpose of this phase is to expan

ID: 3714594 • Letter: C

Question

CASE STUDY – PAYROLL SYSTEM PHASE 5: ARRAY

The purpose of this phase is to expand the payroll system to display all employee information in a tabular form by including arrays.

A) Display company title and a header that labels the output in a tabular form. Input the first name and last name of an employee.

char firstname[100][10], lastname[100][15];

or you may use

#include

using namespace std;

string firstname[100], lastname[100];

int hw[100],empid[100];

Hint: You may want to use the following I/O manipulators.

#include , setw(15), setprecision(2) setiosflags(ios::fixed|ios::showpoint|ios::left)

DR. EBRAHIMI'S PAYROLL INSTITUTE

SSN

HW

HR

OTH

OTP

REGP

GROSS

TAX

NET

===

113

50

20

10

300

800

1100

385

715

223

45

15

5

112.5

675

787.5

275

512.5

B) Take advantage of arrays by breaking programs into separate units. Each unit should have a separate loop. (Do not use functions.)

Read all data into arrays

Compute all the overtimepays

Compute all the grosspays

Compute all the taxratesCompute all the netpays

Display all the arrays

C) Include separate functions to read in the data, compute the gross pay, tax rate, net pay, and overtime pay for all employees, and display.

Need to expand my payroll program, here is what I have so far-

#include <iostream>

using namespace std;

int main(){

    int numberofemployees;

    int employeeid, hoursworked;

    float hourlyrate, grosspay,taxrate,tax,netpay,overtimepay, overtimerate, overtime;

    while ( 1 ){

    if( grosspay <1000)

                        taxrate = 0.30;

            else

                        taxrate = 0.10;{

            if( hoursworked > 40)

                hourlyrate = hourlyrate * 1.5;{

        cout <<"ENTER THE EMPLOYEE ID:";

        cin >>employeeid;

        cout <<"ENTER THE HOURS WORKED:";

        cin >>hoursworked;

        cout <<"ENTER THE HOURLY RATE:";

        cin >>hourlyrate;

        grosspay=hoursworked*hourlyrate;

        tax=taxrate*grosspay;

        netpay=grosspay-tax;

        overtimerate=hourlyrate*1.5;

        overtime=hoursworked - 40;

        overtimepay=overtime*overtimerate;

        cout <<"EMPLOYEE ID IS "<<employeeid;

        cout <<"YOUR HOURS WORKED ARE "<<hoursworked;

        cout <<"YOUR HOURLY RATE IS "<<hourlyrate;

        cout <<"YOUR GROSSPAY IS "<<grosspay;

        cout <<"YOUR TAXRATE IS "<<taxrate;

        cout <<"YOUR NET PAY IS "<<netpay;

        cout <<"YOUR OVERTIME PAY IS "<<overtime;

        numberofemployees = numberofemployees + 1;

    }}}}

FIRST NAME LAST NAME STAT

SSN

HW

HR

OTH

OTP

REGP

GROSS

TAX

NET

======== ======== ==== ====

===

=== ==== ===== ===== ===== ===== ===== John Smith M

113

50

20

10

300

800

1100

385

715

Jane Dow M

223

45

15

5

112.5

675

787.5

275

512.5

Explanation / Answer

Employee.h #ifndef __EMPLOYEE_H__ #define __EMPLOYEE_H__ #include namespace Records { class Employee { public: virtual void set_id(long); virtual long get_id(); virtual void set_first_name(std::string in_first_name); virtual std::string get_first_name(); virtual void set_last_name(std::string in_last_name); virtual std::string get_last_name(); virtual void set_hours_worked(double in_hours_worked)=0; virtual double get_hours_worked()=0; virtual void set_hourly_rate(double in_hourly_rate)=0; virtual double get_hourly_rate()=0; virtual void compute_overtime_hours()=0; virtual double get_overtime_hours()=0; virtual void compute_regular_hours()=0; virtual double get_regular_hours()=0; virtual void compute_regular_pay()=0; virtual double get_regular_pay()=0; virtual void compute_overtime_pay()=0; virtual double get_overtime_pay()=0; virtual void compute_gross_pay()=0; virtual double get_gross_pay()=0; virtual void compute_tax_rate()=0; virtual double get_tax_rate()=0; virtual void compute_net_pay()=0; virtual double get_net_pay()=0; virtual void print_headings(); virtual void display() const; Employee(); virtual ~Employee(); double net_pay; protected: long int id; std::string first_name; std::string last_name; double hours_worked; double hourly_rate; double overtime_hours; double regular_hours; double regular_pay; double overtime_pay; double gross_pay; double tax_rate; double tax_amount; }; } #endif #include #include #include #include "Employee.h" namespace Records { Employee::Employee() :id(123456), first_name("John"), last_name("Doe"), hours_worked(-40.0), hourly_rate(-40.0), overtime_hours(-1), regular_hours(-10), regular_pay(-10), overtime_pay(-20), gross_pay(-23), tax_rate(-4), tax_amount(-2), net_pay(-3) { } Employee::~Employee() { } void Employee::set_id(long in_id) { id = in_id; } long Employee::get_id() { return id; } void Employee::set_first_name(std::string in_first_name) { first_name = in_first_name; } std::string Employee::get_first_name() { return first_name; } void Employee::set_last_name(std::string in_last_name) { last_name = in_last_name; } std::string Employee::get_last_name() { return last_name; } void Employee::print_headings() { std::cout
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