i cant figure this out, here is what im suppose to do

Create a text file containing the pertinent information for the following table(not the identification row):

Employee No.	Department	Pay Rate	Exempt	Hours Worked	   
101	41	8.11	Y           49	   
722	32	7.22	N	40	   
1273	23	5.43	Y	39	   
2584	14	6.74	N	45

Write a C++ program to read the employee file as parallel arrays of employee data using arrays of int, doubles and chars.. Assume that the number of employee records you have to deal with is 4 and create a payroll output file with headers as shown in the following list. The output file is to contain the following data:

a. Employee number (left justified)
b. Department
c. Pay Rate
d. Exempt
e. Hours Worked
f. Base pay (pay rate * hours worked)
g. Overtime pay
h. Total pay

Overtime pay is calculated only for nonexempt employees. An employee is exempt if ‘Y’ appears in the exempt column. Overtime is paid at time-and-a-half for all hours worked over 40. If an exempt employee works over 40 hours, that employee is only paid for 40 hours of work.

MY CODE:

#include <iostream>
#include <iomanip>
#include <string>
#include <fstream>

using namespace std;

#define cls   system("cls")
#define pause system("pause")

const int CHARS_ON_LINE = 80;

const int SIZE = 4;		// for number of employees

void displayInfo(int employee_num, int department, double payrate, char exempt, int hours, double basepay, double overtime, double total);
double calculatepay(double basepay, double total, double overtime, double payrate);


void main()
{
	double payrate;
	double basepay;
	double overtime;
	double total;

	int employee_num;
	int department;
	int hours;

	char exempt = ' ';


	ifstream inFile;

	ofstream outFile;
	
	
	calculatepay(payrate, basepay, overtime, total);
	displayInfo(employee_num, department, payrate, exempt, hours, basepay, overtime, total);

}

double calculatepay(double basepay, double total, double overtime, double payrate)
{
	string inFileName,
		   outFileName;

	int employee_num,	    // employee number
		department,		// department
		hours;			// hours worked

	char exempt;				// for exempt

	ifstream fin("infileLab10.txt");

	fin >> employee_num;
	fin >> department;
	fin >> payrate;
	fin >> exempt;
	fin >> hours;


			   basepay = payrate * hours;
			   overtime = payrate + 1 / 2;
		return total = (overtime * hours > 40) + basepay;
	
}

void displayInfo(int employee_num, int department, double payrate, char exempt, int hours, double basepay, double overtime, double total)
{
	ofstream fout("outfileLab10.txt");
	
		fout << setw(15) << "Employee Number" << setw(15) << "Department" << setw(15) << "Pay Rate"
			 << setw(15) << "Exempt" << setw(15) << "Hours Worked" << setw(15) << "Base Pay" 
			 << setw(15) << "Overtime Pay" << setw(15) << "Total Pay" << endl;

		fout << left << setw(15) << employee_num << right;
		fout << setw(15) << department;
		fout << setw(15) << payrate;
		fout << setw(15) << exempt;
		fout << setw(15) << hours;
		fout << setw(15) << basepay;
		fout << setw(15) << overtime;
		fout << setw(15) << total;

		fout << fixed << setprecision(2);
}

<< moderator edit: added [code][/code] tags >>

that is what i have but i cant get it to work out. i know size has to go in there somewhere but i keep gettin errors in the math (which i know is wrong)
saying that "left operand '*' is double and can not conver to double[]"

can some one help me out im ready to scream.

Recommended Answers

All 3 Replies

Employee No. Department Pay Rate Exempt Hours Worked
101 | 41 | 8.11 | Y | 49
722 | 32 | 7.22 | N | 40
1273 | 23 | 5.43 | Y | 39
2584 | 14 | 6.74 | N | 45

hopefully the you can understand the table a little better this way the "|" divides the sections just incase u were wondering.

im also getting these error right after its starts linking

Lab10.obj : error LNK2001: unresolved external symbol "int __cdecl displayInfo(int,int,double,char,int,double,double,double)" (?displayInfo@@YAHHHNDHNNN@Z)

Lab10.obj : error LNK2001: unresolved external symbol "int __cdecl calculatepay(double,double,double,double,int)" (?calculatepay@@YAHNNNNH@Z)

Lab10.obj : error LNK2001: unresolved external symbol "int __cdecl getInfo(int,int,double,char,int)" (?getInfo@@YAHHHNDH@Z)

Debug/Lab10.exe : fatal error LNK1120: 3 unresolved externals
Error executing link.exe.

Make the function definitions match the prototypes or vice versa.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.