In: Computer Science
// TESTING
//------------------------------------------------------------------------------
// TEST CASE 1
//
// DESCRIPTION
// Performs an acceptance test of the entire program.
//
// INPUT DATA (Note that the input data is read from a file named payroll.txt)
// Simpson Homer
// 15.25 84
// 2
//
// EXPECTED OUTPUT
// -----------------------------
// EMPLOYEE: Simpson, Homer
//
// PAY RATE: $ 15.25
// HOURS: 84.00
// GROSS PAY: $ 1311.50
// MED INS DEDUCT: $ 110.13
// 401K DEDUCT: $ 78.69
// FED TAX GROSS PAY: $ 1122.68
// TAX - FEDERAL: $ 89.48
// TAX - OASDI: $ 69.61
// TAX - MEDICARE: $ 16.28
// TAX - STATE: $ 38.62
// TAX - TOTAL: $ 213.98
// NET PAY: $ 908.70
// -----------------------------
//
// ACTUAL OUTPUT
// RESULT: Write FAIL/pass
#include <cstdlib> // For exit()
#include <fstream> // For ifstream, ofstream
#include <iomanip> // For setprecision(), setw()
#include <iostream> // For endl, fixed
#include <string> // For string class
using namespace std;
//==============================================================================
// FUNCTION PROTOTYPES
//
// Students: Some of the functions may require prototypes. For those that do,
// write the prototype in this section.
//==============================================================================
//==============================================================================
// NAMED CONSTANTS
//
// Students: Define named constants in this section.
//==============================================================================
// Define an int named constant ERR_OPEN_INPUT_FILE which is equivalent to 1.
int ERR_OPEN_INPUT_FILE = 1;
// Define an int named constant ERR_OPEN_OUTPUT_FILE which is equivalent to 2.
int ERR_OPEN_INPUT_FULE = 2;
// This is the percentage rate for calculating the OASDI deduction (this is com-
// monly known as social security). It is 6.2% of the employee's federal taxable
// gross pay.
const double SOCIAL_SECURITY = 0.062;
// All employees are required to contribute 6.0% of their pretax gross pay to
// the company 401K plan.
const double FOUR01K_PLAN = 0.06;
// Define a double constant named MEDICARE_RATE initialized to 0.0145.
// This is the percentage rate for calculating the medicare deduction. It is
// 1.45% of the employee's federal taxable gross pay.
// ???
const double MEDICARE_RATE = 0.0145;
// These constants are the monthly costs for each of the medical insurance
// plans. The amount an employee pays depends on his or her medical insurance
// status (see the group of constants following this group).
const double MEDICAL_INSURANCE_DEDUCT_EMPLOYEE_ONLY = 32.16; // Employee Only
const double MEDICAL_INSURANCE_DEDUCT_EMPLOYEE_PLUS_ONE = 64.97; // Employee + One
const double MEDICAL_INSURANCE_DEDUCT_FAMILY = 110.13; // Family
// These constants match the numbers for the employee's medical insurance status
// that will be in the input file.
const int MEDICAL_INSURANCE_STATUS_EMPLOYEE_ONLY = 0; // Employee Only
const int MEDICAL_INSURANCE_STATUS_EMPLOYEE_PLUS_ONE = 1; // Employee + One
const int MEDICAL_INSURANCE_STATUS_FAMILY = 2; // Family
void ErrorExit (string msg)
{
cout << msg << endl;
exit (-1);
}
//------------------------------------------------------------------------------
// FUNCTION: calc_gross_pay()
//
// Calculates and returns an employee's gross pay which is based on the number
// of hours worked (in parameter hrs_worked) and the employee's pay rate (in
// parameter pay_rate).
//------------------------------------------------------------------------------
double calc_gross_pay(double pay_rate, double hrs_worked)
{
double gross_pay;
if (hrs_worked <= 80){
gross_pay = hrs_worked * pay_rate;
} else {
gross_pay = (80 * pay_rate) + (hrs_worked - 80) * (1.5 * pay_rate);
}
return gross_pay;
}
//------------------------------------------------------------------------------
// FUNCTION: calc_med_ins_deduct()
//
// Determines and returns the employee's medical insurance deduction which is
// based on the employee's medical insurance status in parameter med_ins_status.
//------------------------------------------------------------------------------
double calc_med_ins_deduct (int med_ins_status){
double MedInsDeduct = 0;
if (med_ins_status == MEDICAL_INSURANCE_STATUS_EMPLOYEE_ONLY){
MedInsDeduct = MEDICAL_INSURANCE_DEDUCT_EMPLOYEE_ONLY;}
else if (med_ins_status == MEDICAL_INSURANCE_STATUS_EMPLOYEE_PLUS_ONE){
MedInsDeduct = MEDICAL_INSURANCE_DEDUCT_EMPLOYEE_PLUS_ONE;}
else {MedInsDeduct = MEDICAL_INSURANCE_DEDUCT_FAMILY;}
return MedInsDeduct;
}
//------------------------------------------------------------------------------
// FUNCTION: calc_tax_fed()
//
// Calculates and returns the employee's federal income tax which is based on
// his or her federal taxable gross pay (in parameter fed_tax_gross_pay) and the
// federal tax withholding percentage table in the lab project document.
//------------------------------------------------------------------------------
double calc_tax_fed(double fed_tax_gross_pay){
double tax_fed = 0;
if(fed_tax_gross_pay >= 384.62 && fed_tax_gross_pay < 1413.67){
tax_fed = fed_tax_gross_pay * 0.0797;
} else if (fed_tax_gross_pay >= 1413.67 && fed_tax_gross_pay < 2695.43){
tax_fed = 0.1275 * fed_tax_gross_pay;
} else if (fed_tax_gross_pay >= 2695.43){
tax_fed = 0.195 * fed_tax_gross_pay;
}
return tax_fed;}
//------------------------------------------------------------------------------
// FUNCTION: calc_tax_state()
//
// Calculates and returns the employee's state income tax which is based on his
// or her federal taxable gross pay (in parameter fed_tax_gross_pay) and the
// state tax withholding percentage table in the lab project document.
//------------------------------------------------------------------------------
double calc_tax_state(double fed_tax_gross_pay)
{
double tax_state = 0;
if (fed_tax_gross_pay < 961.54) {
tax_state = fed_tax_gross_pay * 0.0119;
} else if (fed_tax_gross_pay < 2145.66) {
tax_state = fed_tax_gross_pay * 0.0344;
} else {
tax_state = fed_tax_gross_pay * 0.0774;
}
return tax_state;
}
//------------------------------------------------------------------------------
// open_input_file(ifstream&, string) -> nothing
//
// See the comments in the function header of this function in main.cpp of Lab
// Project 6 for more information on how this function operates. Copy-and-paste
// the code for this function from your Lab 6 main.cpp source code file.
//------------------------------------------------------------------------------
void open_input_file(ifstream& fin , string);
void terminate (string msg){
cout << "Could not open Payroll.txt";
}
//------------------------------------------------------------------------------
// open_output_file(ofstream&, string) -> nothing
//
// See the comments in the function header of this function in main.cpp of Lab
// Project 6 for more information on how this function operates. Copy-and-paste
// the code for this function from your Lab 6 main.cpp source code file.
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
// terminate(string, int) -> nothing
//
// See the comments in the function header of this function in main.cpp of Lab
// Project 6 for more information on how this function operates. Copy-and-paste
// the code for this function from your Lab 6 main.cpp source code file.
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
// FUNCTION: main()
//
// This is the starting point of execution.
//------------------------------------------------------------------------------
int main()
{
// Define an ifstream object named 'fin' to read from the input file. Then
// call open_input_file() passing "payroll.txt" as the name of the file to
// be opened. If the file could not be opened for reading, then open_input
// _file() will not return.
ifstream fin;
if(!fin){
ErrorExit ("Payroll.txt could not be opened for writing");}
// Read the employee's last and first names from the input file.
string first_name, last_name;
fin >> last_name >> first_name;
// Read the employee's pay rate from the input file.
double pay_rate;
fin >> pay_rate;
// Read the employee's hours worked from the input file.
double hrs_worked;
fin >> hrs_worked;
// Read the employee's medical insurance status from the input file.
int med_ins_status;
fin >> med_ins_status;
// Close the input file because we're done reading from it.
fin.close();
// Call calc_gross_pay() to calculate the employee's gross pay. The input
// params are pay_rate and hrs_worked. The return value is assigned to vari-
// able gross_pay which is defined as a double.
double gross_pay = calc_gross_pay(pay_rate, hrs_worked);
// Calculate the employee's mandatory contribution to his/her 401k. This is
// gross_pay multiplied by the 401K rate.
double four01k_deduct = gross_pay * FOUR01K_PLAN;
// Call calc_med_ins_deduct() to determine the employee's medical insurance
// deduction which is based on the employee's medical insurance status
// stored in med_ins_status. The return value is assigned to variable
// med_ins_deduct which is defined as a double.
double med_ins_deduct = calc_med_ins_deduct(med_ins_status);
// Calculate the employee's federal taxable gross pay which is gross_pay
// minus deductions for medical insurance and 401K.
double fed_tax_gross_pay = gross_pay - med_ins_deduct - four01k_deduct;
// Call calc_tax_fed() to calculate the employee's federal income tax. The
// input parameter is fed_tax_gross_pay and the returned value is assigned
// to variable tax_fed which is defined as a double.
double tax_fed = calc_tax_fed(fed_tax_gross_pay);
// Calculate the amount withheld for OASDI and store in tax_oasdi.
double tax_oasdi = fed_tax_gross_pay * SOCIAL_SECURITY;
// Calculate the amount withheld for medicare and store in tax_medicare.
double tax_medicare = fed_tax_gross_pay * MEDICARE_RATE;
// Call calc_tax_state() to determine the employee's state tax deduction.
// The input parameter is fed_tax_gross_pay and the returned value is
// assigned to variable tax_state which is defined as a double.
double tax_state = calc_tax_state(fed_tax_gross_pay);
// Calculate the employee's total tax which is the sum of his/her federal
// tax, OASDI tax, medicare tax, and state tax. Assign to tax_total.
double tax_total = tax_fed + tax_oasdi + tax_medicare + tax_state;
// Calculate the employee's net pay which is federal taxable gross pay with
// taxes deducted. Assign to net_pay.
double net_pay = fed_tax_gross_pay - tax_total;
// Define an ofstream object named fout to write to the output file. Then
// call open_output_file() passing fout and "paycheck.txt" as the name of
// the file to be opened. If the file could not be opened for writing, then
// open_output_file() will not return.
ofstream fout;
fout.open("Paycheck.txt");
if(!fout){
ErrorExit("Payroll.txt couldn't be opened for writing.");
}
// Configure fout so real numbers will be printed in fixed notation with two
// digits after the decimal point.
fout << fixed << setprecision(2);
// Configure fout so the numbers will be printed right-justified in their
// respective fields.
fout << right;
// Output the employee paycheck. All numerical values are output in a field
// of width 8.
fout << "-----------------------------" << endl;
fout << "EMPLOYEE: " << last_name << ", " << first_name << endl << endl;
fout << "PAY RATE: $" << setw(8) << pay_rate << endl;
fout << "HOURS: " << setw(8) << hrs_worked << endl;
fout << "GROSS PAY: $" << setw(8) << gross_pay << endl;
fout << "MED INS DEDUCT: $" << setw(8) << med_ins_deduct << endl;
fout << "401K DEDUCT: $" << setw(8) << four01k_deduct << endl;
fout << "FED TAX GROSS PAY: $" << setw(8) << fed_tax_gross_pay << endl;
fout << "TAX - FEDERAL: $" << setw(8) << tax_fed << endl;
fout << "TAX - OASDI: $" << setw(8) << tax_oasdi << endl;
fout << "TAX - MEDICARE: $" << setw(8) << tax_medicare << endl;
fout << "TAX - STATE: $" << setw(8) << tax_state << endl;
fout << "TAX - TOTAL: $" << setw(8) << tax_total << endl;
fout << "NET PAY: $" << setw(8) << net_pay << endl;
fout << "-----------------------------" << endl;
// Close the output file.
fout.close();
// pause the system for a while
system("pause");
// Return 0 from main() to indicate to the OS that the program terminated
// normally.
return 0;
}
// TEST CASE 1
//
// DESCRIPTION
// Performs an acceptance test of the entire program.
//
// INPUT DATA (Note that the input data is read from a file named
payroll.txt)
// Simpson Homer
// 15.25 84
// 2
//
// EXPECTED OUTPUT
// -----------------------------
// EMPLOYEE: Simpson, Homer
//
// PAY RATE: $ 15.25
// HOURS: 84.00
// GROSS PAY: $ 1311.50
// MED INS DEDUCT: $ 110.13
// 401K DEDUCT: $ 78.69
// FED TAX GROSS PAY: $ 1122.68
// TAX - FEDERAL: $ 89.48
// TAX - OASDI: $ 69.61
// TAX - MEDICARE: $ 16.28
// TAX - STATE: $ 38.62
// TAX - TOTAL: $ 213.98
// NET PAY: $ 908.70
// -----------------------------
//
// ACTUAL OUTPUT
// RESULT: Write FAIL/pass
#include <cstdlib> // For exit()
#include <fstream> // For ifstream, ofstream
#include <iomanip> // For setprecision(), setw()
#include <iostream> // For endl, fixed
#include <string> // For string class
using namespace std;
//==============================================================================
// FUNCTION PROTOTYPES
//
// Students: Some of the functions may require prototypes. For
those that do,
// write the prototype in this section.
//==============================================================================
//==============================================================================
// NAMED CONSTANTS
//
// Students: Define named constants in this section.
//==============================================================================
// Define an int named constant ERR_OPEN_INPUT_FILE which is
equivalent to 1.
int ERR_OPEN_INPUT_FILE = 1;
// Define an int named constant ERR_OPEN_OUTPUT_FILE which is
equivalent to 2.
int ERR_OPEN_INPUT_FULE = 2;
// This is the percentage rate for calculating the OASDI
deduction (this is
// commonly known as social security). It is 6.2% of the employee's
federal taxable
// gross pay.
const double SOCIAL_SECURITY = 0.062;
// All employees are required to contribute 6.0% of their pretax
gross pay to
// the company 401K plan.
const double FOUR01K_PLAN = 0.06;
// Define a double constant named MEDICARE_RATE initialized to
0.0145.
// This is the percentage rate for calculating the medicare
deduction. It is
// 1.45% of the employee's federal taxable gross pay.
// ???
const double MEDICARE_RATE = 0.0145;
// These constants are the monthly costs for each of the medical
insurance
// plans. The amount an employee pays depends on his or her medical
insurance
// status (see the group of constants following this group).
const double MEDICAL_INSURANCE_DEDUCT_EMPLOYEE_ONLY = 32.16; //
Employee Only
const double MEDICAL_INSURANCE_DEDUCT_EMPLOYEE_PLUS_ONE = 64.97; // Employee + One
const double MEDICAL_INSURANCE_DEDUCT_FAMILY = 110.13; // Family
// These constants match the numbers for the employee's medical
insurance status
// that will be in the input file.
const int MEDICAL_INSURANCE_STATUS_EMPLOYEE_ONLY = 0; // Employee
Only
const int MEDICAL_INSURANCE_STATUS_EMPLOYEE_PLUS_ONE = 1; // Employee + One
const int MEDICAL_INSURANCE_STATUS_FAMILY = 2; // Family
void ErrorExit (string msg)
{
cout << msg << endl;
exit (-1);
}
//------------------------------------------------------------------------------
// FUNCTION: calc_gross_pay()
//
// Calculates and returns an employee's gross pay which is based on
the number
// of hours worked (in parameter hrs_worked) and the employee's pay
rate (in
// parameter pay_rate).
//------------------------------------------------------------------------------
double calc_gross_pay(double pay_rate, double hrs_worked)
{
double gross_pay;
if (hrs_worked <= 80)
{
gross_pay = hrs_worked * pay_rate;
}
else
{
gross_pay = (80 * pay_rate) + (hrs_worked - 80) * (1.5 *
pay_rate);
}
return gross_pay;
}
//------------------------------------------------------------------------------
// FUNCTION: calc_med_ins_deduct()
//
// Determines and returns the employee's medical insurance
deduction which is
// based on the employee's medical insurance status in parameter
med_ins_status.
//------------------------------------------------------------------------------
double calc_med_ins_deduct (int med_ins_status)
{
double MedInsDeduct = 0;
if (med_ins_status == MEDICAL_INSURANCE_STATUS_EMPLOYEE_ONLY)
{
MedInsDeduct = MEDICAL_INSURANCE_DEDUCT_EMPLOYEE_ONLY;
}
else if (med_ins_status ==
MEDICAL_INSURANCE_STATUS_EMPLOYEE_PLUS_ONE)
{
MedInsDeduct = MEDICAL_INSURANCE_DEDUCT_EMPLOYEE_PLUS_ONE;
}
else
{
MedInsDeduct = MEDICAL_INSURANCE_DEDUCT_FAMILY;
}
return MedInsDeduct;
}
//------------------------------------------------------------------------------
// FUNCTION: calc_tax_fed()
//
// Calculates and returns the employee's federal income tax which
is based on
// his or her federal taxable gross pay (in parameter
fed_tax_gross_pay) and the
// federal tax withholding percentage table in the lab project
document.
//------------------------------------------------------------------------------
double calc_tax_fed(double fed_tax_gross_pay)
{
double tax_fed = 0;
if(fed_tax_gross_pay >= 384.62 && fed_tax_gross_pay <
1413.67)
{
tax_fed = fed_tax_gross_pay * 0.0797;
}
else if (fed_tax_gross_pay >= 1413.67 &&
fed_tax_gross_pay < 2695.43)
{
tax_fed = 0.1275 * fed_tax_gross_pay;
}
else if (fed_tax_gross_pay >= 2695.43)
{
tax_fed = 0.195 * fed_tax_gross_pay;
}
return tax_fed;
}
//------------------------------------------------------------------------------
// FUNCTION: calc_tax_state()
//
// Calculates and returns the employee's state income tax which is
based on his
// or her federal taxable gross pay (in parameter
fed_tax_gross_pay) and the
// state tax withholding percentage table in the lab project
document.
//------------------------------------------------------------------------------
double calc_tax_state(double fed_tax_gross_pay)
{
double tax_state = 0;
if (fed_tax_gross_pay < 961.54)
{
tax_state = fed_tax_gross_pay * 0.0119;
}
else if (fed_tax_gross_pay < 2145.66)
{
tax_state = fed_tax_gross_pay * 0.0344;
}
else
{
tax_state = fed_tax_gross_pay * 0.0774;
}
return tax_state;
}
//------------------------------------------------------------------------------
// open_input_file(ifstream&, string) -> nothing
//
// See the comments in the function header of this function in
main.cpp of Lab
// Project 6 for more information on how this function operates.
Copy-and-paste
// the code for this function from your Lab 6 main.cpp source code
file.
//------------------------------------------------------------------------------
void open_input_file(ifstream& fin, string fileName)
{
fin.open(fileName.c_str());
}
void terminate (string msg)
{
cout << "Could not open "<<msg;
}
//------------------------------------------------------------------------------
// open_output_file(ofstream&, string) -> nothing
//
// See the comments in the function header of this function in
main.cpp of Lab
// Project 6 for more information on how this function operates.
Copy-and-paste
// the code for this function from your Lab 6 main.cpp source code
file.
//------------------------------------------------------------------------------
void open_output_file(ofstream &fout, string fileName)
{
fout.open(fileName.c_str());
}
//------------------------------------------------------------------------------
// terminate(string, int) -> nothing
//
// See the comments in the function header of this function in
main.cpp of Lab
// Project 6 for more information on how this function operates.
Copy-and-paste
// the code for this function from your Lab 6 main.cpp source code
file.
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
// FUNCTION: main()
//
// This is the starting point of execution.
//------------------------------------------------------------------------------
int main()
{
// Define an ifstream object named 'fin' to read from the input
file. Then
// call open_input_file() passing "payroll.txt" as the name of the
file to
// be opened. If the file could not be opened for reading, then
open_input
// _file() will not return.
ifstream fin;
open_input_file(fin, "payroll.txt");
if(!fin)
{
terminate("Payroll.txt");
ErrorExit("Payroll.txt couldn't be opened for reading.");
}
// Read the employee's last and first names from the input
file.
string first_name, last_name;
fin >> last_name >> first_name;
// Read the employee's pay rate from the input file.
double pay_rate;
fin >> pay_rate;
// Read the employee's hours worked from the input file.
double hrs_worked;
fin >> hrs_worked;
// Read the employee's medical insurance status from the input
file.
int med_ins_status;
fin >> med_ins_status;
// Close the input file because we're done reading from
it.
fin.close();
// Call calc_gross_pay() to calculate the employee's gross pay.
The input
// params are pay_rate and hrs_worked. The return value is assigned
to vari-
// able gross_pay which is defined as a double.
double gross_pay = calc_gross_pay(pay_rate, hrs_worked);
// Calculate the employee's mandatory contribution to his/her
401k. This is
// gross_pay multiplied by the 401K rate.
double four01k_deduct = gross_pay * FOUR01K_PLAN;
// Call calc_med_ins_deduct() to determine the employee's
medical insurance
// deduction which is based on the employee's medical insurance
status
// stored in med_ins_status. The return value is assigned to
variable
// med_ins_deduct which is defined as a double.
double med_ins_deduct = calc_med_ins_deduct(med_ins_status);
// Calculate the employee's federal taxable gross pay which is
gross_pay
// minus deductions for medical insurance and 401K.
double fed_tax_gross_pay = gross_pay - med_ins_deduct -
four01k_deduct;
// Call calc_tax_fed() to calculate the employee's federal
income tax. The
// input parameter is fed_tax_gross_pay and the returned value is
assigned
// to variable tax_fed which is defined as a double.
double tax_fed = calc_tax_fed(fed_tax_gross_pay);
// Calculate the amount withheld for OASDI and store in
tax_oasdi.
double tax_oasdi = fed_tax_gross_pay * SOCIAL_SECURITY;
// Calculate the amount withheld for medicare and store in
tax_medicare.
double tax_medicare = fed_tax_gross_pay * MEDICARE_RATE;
// Call calc_tax_state() to determine the employee's state tax
deduction.
// The input parameter is fed_tax_gross_pay and the returned value
is
// assigned to variable tax_state which is defined as a
double.
double tax_state = calc_tax_state(fed_tax_gross_pay);
// Calculate the employee's total tax which is the sum of
his/her federal
// tax, OASDI tax, medicare tax, and state tax. Assign to
tax_total.
double tax_total = tax_fed + tax_oasdi + tax_medicare +
tax_state;
// Calculate the employee's net pay which is federal taxable
gross pay with
// taxes deducted. Assign to net_pay.
double net_pay = fed_tax_gross_pay - tax_total;
// Define an ofstream object named fout to write to the output
file. Then
// call open_output_file() passing fout and "paycheck.txt" as the
name of
// the file to be opened. If the file could not be opened for
writing, then
// open_output_file() will not return.
ofstream fout;
open_output_file(fout, "paycheck.txt");
if(!fout)
{
terminate("paycheck.txt");
ErrorExit("paycheck.txt couldn't be opened for writing.");
}
// Configure fout so real numbers will be printed in fixed
notation with two
// digits after the decimal point.
fout << fixed << setprecision(2);
// Configure fout so the numbers will be printed right-justified
in their
// respective fields.
fout << right;
// Output the employee paycheck. All numerical values are output
in a field
// of width 8.
fout << "-----------------------------" << endl;
fout << "EMPLOYEE: " << last_name << ", "
<< first_name << endl << endl;
fout << "PAY RATE: $" << setw(8) << pay_rate
<< endl;
fout << "HOURS: " << setw(8) << hrs_worked
<< endl;
fout << "GROSS PAY: $" << setw(8) << gross_pay
<< endl;
fout << "MED INS DEDUCT: $" << setw(8) <<
med_ins_deduct << endl;
fout << "401K DEDUCT: $" << setw(8) <<
four01k_deduct << endl;
fout << "FED TAX GROSS PAY: $" << setw(8) <<
fed_tax_gross_pay << endl;
fout << "TAX - FEDERAL: $" << setw(8) << tax_fed
<< endl;
fout << "TAX - OASDI: $" << setw(8) << tax_oasdi
<< endl;
fout << "TAX - MEDICARE: $" << setw(8) <<
tax_medicare << endl;
fout << "TAX - STATE: $" << setw(8) << tax_state
<< endl;
fout << "TAX - TOTAL: $" << setw(8) << tax_total
<< endl;
fout << "NET PAY: $" << setw(8) << net_pay
<< endl;
fout << "-----------------------------" << endl;
// Close the output file.
fout.close();
// pause the system for a while
system("pause");
// Return 0 from main() to indicate to the OS that the program
terminated
// normally.
return 0;
}
payroll.txt file contents
Simpson Homer
15.25 84
2
Paycheck.txt file contents
-----------------------------
EMPLOYEE: Simpson, Homer
PAY RATE: $ 15.25
HOURS: 84.00
GROSS PAY: $ 1311.50
MED INS DEDUCT: $ 110.13
401K DEDUCT: $ 78.69
FED TAX GROSS PAY: $ 1122.68
TAX - FEDERAL: $ 89.48
TAX - OASDI: $ 69.61
TAX - MEDICARE: $ 16.28
TAX - STATE: $ 38.62
TAX - TOTAL: $ 213.98
NET PAY: $ 908.70
-----------------------------