### program of employee class

Hi,
What's the problem of my program?
 ``123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120`` ``````#include #include using namespace std; const int n=10; class employee { int a; int h; int n; int e; int m; int h_total; string f; string l; public: void employeeID(); void first(); void last(); void base_salary(); double wages_per_hour(); void print_wages_per_hour(); void overtime_hrs(); void TAX_rate(); int total_wage(); void print_total_wage(); friend void sort(employee myemployee[],int n); }; void employee :: employeeID() { cout<<"Enter ID Number:"; cin>>a; } void employee::first() { cout<<"Enter First Name:"; cin>>f; } void employee ::last() { cout<<"Enter Last Name:"; cin>>l; } void employee :: base_salary() { cout<<"Enter Base Salary:"; cin>>h; } double employee :: wages_per_hour() { return n=(h/26)/8; } void employee :: print_wages_per_hour() { cout<<"Enter Your Wages Per Hour"<>e; } void employee :: TAX_rate() { cout<<"Enter TAX_rate() cin>>m; } int employee :: total_wage() { return h_total=(h + (e*n)) - (h*m)/100 ; } void employee :: print_total_wage() { cout<<"Total Wages"myemployee[i+1].h_total) { myemployee[i].h_total=hold; myemployee[i].h_total=myemployee[i+1].h_total; myemployee[i+1].h_total=hold; } } } for (int i=0;i
Last edited on
Line 65 is missing a `" `
Check out the color of the text. That's your first hint. You're missing a quote in line 65.

Second, you're missing a semi-colon in line 65.

Third, you're missing a < in line 74 (should be <<endl; not <endl;)

Fourth, remove [] from myemployee in line 96.

Fifth, remove int from n in line 96.

That fixes the compiler errors. Your compiler would tell you the same thing in the output if you had looked at that.
Last edited on
Also on line 65 you have written `cout<<"Enter TAX_rate() `. Corrected as per the above posts that would leave `cout<<"Enter TAX_rate()";` Since you are writing this to your user there is no need to display the name of the function. ` cout<<"Enter tax rate:";` would probably leave the user less confused.
Errors fixed but It has a bug in line 110 .when first wage Is larger than second wage It tells "uninitialized local variable 'hold' used " and doesn't give any sort.
See that variable `hold`? It doesn't have a value set. It could be anything. It could be zero. It could be a million. It could be minus ten. You're using it without ever having given it a value.
Thank you for answers .It fixed
Topic archived. No new replies allowed.