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

Write a program that will calculate the net pay of an employee. The steps for ca

ID: 3734219 • Letter: W

Question

Write a program that will calculate the net pay of an employee. The steps for calculating the net pay is 4. ing functions: A function that gets the employee's hourly pay rate A function that gets the number of hours worked A function that calculates the employee's gross pay A function that calculates the overtime pay . A function that calculates the withholdings for taxes and benefits A function that calculates the net pay . A function that prints the paycheck The calls of each functions happens as follows: main) calc gross_pay calc_overtime0 calc_withholdings0 calc_net pay0 get hours worked get hourly_rate calc_taxes0 calc_benefits0

Explanation / Answer

Program plan:As per the question we need to create 9 functions and all functions called by a calee function which in turn called by another function.main method function is the one who first initialts after that other functions called.

program:

#include<iostream.h>
#include<conio.h>
float salary,rateperhour;
int hoursworked;
float get_hourly_rate();
int get_hours_worked();
float calc_overtime();
float calc_gross_pay();
float calc_withholdings();
float calc_taxes;
float calc_benefits();
float calc_netpay();
void get_input()
{
cout<<"enter emplyee salary:";
cin>>salary;
rateperhour=get_hourly_rate();
hoursworked=get_hours_worked();
}
float get_hourly_rate()
{
float r;
cout<<"enter hours rate:";
cin>>r;
return r;
}
int get_hours_worked()
{
int hw;
cout<<"enter hours worked: ";
cin>>hw;
return hw;
}
float calc_overtime()
{
int overtime;
cout<<"enter oveertime worked hours:";
cin>>overtime;
return (rateperhour*overtime);
}
float calc_gross_pay()
{
return (salary+calc_overtime());
}
float calc_taxes()
{
return (salary*0.01);//10% on salary
}
float calc_banefits()
{
return (salary*0.05);//5% on salary
}
float calc_withholdings()
{
float tax,ben;
tax=calc_taxes();
ben=calc_benefits();
return tax+ben;

}

float calc_netpay()
{
float net;
net=calc_gross_pay()-calc_withholdings();
return net;
}

void main()
{
clrscr();
get_input();
cout<<"pay check is ";
cout<<"gross pay is: "<<calc_gross_pay();
cout<<"net pay of the Employee: "<<calc_netpay();
getch();
}

Sample output:

enter employee salary:2000

enter hours rate:2

enter hours worked:8

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