I am trying to get an infile/outfile code for the following. According to my professor I need a ReadInputData, CalculateGrossPay, CalculateTaxPay, CalculateNetPay, WriteOutputData. I know I have to separate some of algorithms. I also not sure if I got the 401k correct. Any help?
//The Payroll Calculator program to enter specific data
#include <iostream>
#include <iomanip>
#include <string>
#include <fstream>
outFile << "ENTER THE HOURS WORKED: ";
inFile >> hWorked;
outFile << "Enter Employee Type: ";
outFile << "M or m (a manager employee),";
outFile << "C or c (a contractor employee),";
outFile << "L or l (a level employee),";
inFile >> employeeType;
outFile << endl;
outFile << "A or a ($25.00 Insurance Deduction)," << endl;
outFile << "B or b ($15.00 Insurance Deduction)," << endl;
outFile << "C or c ($0.00 Insurance Deduction)," << endl;
inFile >> choice;
outFile << endl;
switch (employeeType)
{
//Manager Hourly Pay Rate
case 'm':
case 'M':
hRate = Mrate;
break;
//Contrator Hourly Pay Rate
case 'c':
case 'C':
hRate = Crate;
break;
//Level Hourly Pay Rate
case 'l':
case 'L':
hRate = Lrate;
break;
default:
hRate = Lrate;
}
if (choice == 'A')
insDeduct = 25.00;
if (choice == 'B')
insDeduct = 15.00;
if (choice == 'C')
insDeduct = 0.00;
//Caculates employee regular pay with overtime.
//The first 8 hours are calculated at hRate + 50%.
//Any hours beyond are double time + grosspay.
if (hWorked <= 40)
{
grossPay = (hRate * hWorked) - cont401k;
}
PLEASE USE CODE TAGS (the <> formatting button) when posting code.
It makes it easier to read your code and also easier to respond to your
post. http://www.cplusplus.com/articles/jEywvCM9/
Hint: You can edit your post, highlight your code and press the <>
formatting button.