| | |
AHHHH!! i cant figure this out.
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Mar 2005
Posts: 91
Reputation:
Solved Threads: 1
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):
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:
<< 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.
Create a text file containing the pertinent information for the following table(not the identification row):
C++ Syntax (Toggle Plain Text)
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:
C++ Syntax (Toggle Plain Text)
#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); }
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.
•
•
Join Date: Mar 2005
Posts: 91
Reputation:
Solved Threads: 1
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.
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.
"One of the methods used by statists to destroy capitalism consists in establishing controls that tie a given industry hand and foot, making it unable to solve its problems, then declaring that freedom has failed and stronger controls are necessary." --Ayn Rand
![]() |
Similar Threads
- New programming language: Who can figure it out? (Computer Science)
- Figure this one out (CD ROM) (Storage)
- Floating Menus: I have a problem, can you help me figure it out? (HTML and CSS)
- Homework Help for C++ Beginner -- I've tried and tried, and can't figure it out!! (C++)
- help with significant figure function (C)
- Cannot figure out why I'm getting these Errors (Java)
- figure this out (C++)
Other Threads in the C++ Forum
| Thread Tools | Search this Thread |
api application array arrays based beginner binary bmp c++ c/c++ calculator char char* class classes code coding compile compiler console conversion convert count data database delete deploy developer dll download dynamiccharacterarray email encryption error file format forms fstream function functions game generator givemetehcodez graph gui homeworkhelp iamthwee ifstream image input int java lib library list loop looping loops map math matrix memory multiple newbie news number numbertoword output pointer problem program programming project python random read recursion recursive reference rpg simple sorting string strings temperature template text text-file tree url variable vector video visual visualstudio win32 windows winsock wordfrequency wxwidgets






