C++ Assignment 3A
C++ Assignment 3A
3.0 Payroll
3.1 printReportHeadings();
3.2 initializeAccumulators(inout totFedTax as real, inout totStateTax as real, inout totGross as real,
inout totHours as real, inout totPayRate as real, inout totDeferred as real,
inout totOvertimeHours as real);
3.3 inputEmployeeData (out lastName as string, out firstName as string, out hours as real,
out payRate as real, out deferred as real);
3.4 calculateGross(in hours as real, in payrate as real, out gross as real);
3.5 calculateTaxes(in gross as real, in deferred as real, out fedTax as real,
out stateTax as real, out ssiTax as real);
3.5.1 calcFedTax(in gross as real, in deferred as real, out fedTax);
3.5.2 calcStateTax(in fedTax as real, out stateTax);
3.5.3 ccalcSSITax( in gross as float, in float as deferred, out ssiTax);
3.6 calcNetPay(in gross as real, in fedTax as real, in stateTax asreal, in ssiTax as real, out netPay as real);
3.7 calcRegularHours(in hours as real, out regularHours as real);
3.8 calcOvertimeHours(in hours as real, out overtimeHours as real);
3.9 printEmployeeData(in reportFile, in lastName as string, in firstName as string, in hours as real,
in payRate as real, in gross as real, in deferred as real, in fedTax as real, in stateTax as real,
in ssiTax as real);
3.10 addDetailsToAccumulator(inout totFedTax as real,inout totStateTax as real, inout totGross as real,
ionut totHours as real, inout totPayRate as real, inout totDeferred as real, inout totOvertimeHours as real,
in fedTax as real, in stateTax as real, in ssiTax as real, in gross as real, in hours as real,
in payRate as real, in deferred as real, in regularHours as real, in overtimeHours as real);
3.11 addEmployee(out answer as boolean);
3.12 printSummaryReport(in reportFile, in totFedTax as real, in totStateTax as real,in totGross as real,
in totHours as real, in totPayRate as real, in totDeferred as real, in totOvertimeHours as real);
3.12.1 printTotal(in reportFile, in totFedTax as real, in totStateTax as real, in totGross as real,
in totHours as real, in totPayRate as real, in totDeferred as real, in totOvertimeHours as real);
3.12.2 printAverage(in reportFile, in totFedTax as real, in totStateTax as real, in totGross as real,
in totHours as real, in totPayRate as real, in totDeferred as real, in totOvertimeHours as real);
b) flowchart
====== \n"
enum totalsList {FEDTAX, STATETAX, SSITAX, GROSS, HOURS, PAYRATE, DEFERRED, REGULARHOURS, OVERTIMEHOURS,
EMPLOYEES,NETPAY,TOTALS};
{
int i = 0;
inputEmployeeData(employeeData[i]); // 3.3
employeeData[i].gross = calculateGross(employeeData[i]); // 3.4
calculateTaxes(employeeData[i]); // 3.5
calcNetPay(employeeData[i]); // 3.6
calcRegularHours(employeeData[i]); // 3.7
calcOvertimeHours(employeeData[i]); // 3.8
printEmployeeData(reportFile,employeeData[i]); // 3.9
addDetailsToAccumulator(total, employeeData[i]); // 3.10
addEmployee = addEmployeeAnsw(); // 3.11
i++;
}
printSummaryReport(reportFile, total); //3.12
fclose(reportFile); // step 4 for a file
while (getchar() != '\n'); // same as fflush(stdin)
return 0;
}
void printReportHeadings(FILE * reportFile) // 3.1
{
fprintf(reportFile,REPLINEA);
fprintf(reportFile,REPLINEB);
fprintf(reportFile,REPLINEC);
}
void initializeAccumulators(float total[]) //3.2
{
for (int i = 0; i < TOTALS; i++)
{
total[i] = 0;
}
}
main2.cpp calculateTaxes.o
g++ main2.cpp calculateTaxes.o o run.exe
calculateTaxes.o:
calculateTaxes.cpp
g++ -c calculateTaxes.cpp o calculateTaxes.o