C++ program (IMPORTANT)

Users who are viewing this thread

N

NightWarrior

Guest
Nic,

I gave you the code because it was exactly what was needed. ComputeHourlyPay should only look like this:

double ComputeHourlyPay(double hoursWorked, double hourlyRate)
{
return hoursWorked * hourlyRate;
}

You can't have ComputeHourlyPay figuring out OT pay and regular pay, how would you ever get those values back? You will have to call this function twice as it is above, once for the hours 40 and under and then once for the hours 41+. I made it simple, gave you the code already. What you have makes it impossible to display regular pay and ot pay because ComputeHourlyPay as you have it will only return total pay. Think about it....
 
  • 57
    Replies
  • 2K
    Views
  • 0
    Participant count
    Participants list

NicAuf

Active Member
Messages
3,136
Reaction score
0
Tokenz
0.00z
I got it all figured out. Venom you were a great help, made my job alot easier. Thanks for all the help.
 
N

NightWarrior

Guest
You have an error in ProcessManufacturingWorker(). Your call to ChooseProductionLineMenu() should be ans = ChooseProductionLineMenu().

I'm glad I could help. Reppage my man! :)
 
N

NightWarrior

Guest
I'm not sick of you man, but whats the error your getting and when does it happen? I mean is it a compiler error or a run time one?

Thats an ugly way to pass variables around. I wouldn't do it this way. Hardly do you see programmers passing around pointers to memory spots as function parameters, its not good practice IMHO. Especially for what you are doing here.

But I need more info like what your error is. I don't have time to look this over by eye trying to debug it like that.

You need to modify your case statements in ConvertToNumericGrade(). Your requirement is to be able to handle both upper and lowercase grades, right now an 'a' would return 0.0. Hint: Case 'A', 'a':

I'm really having a problem following this passing around those "global" variables like that. Is this what your professor required you to do on this assignment? I sure hope not. Thats not cool at all.
 

NicAuf

Active Member
Messages
3,136
Reaction score
0
Tokenz
0.00z
Well this program is ours first using call-by-reference variables so I might be overusing them. But the error says something concerning an .obj and .exe. I'm gonna work on it a little more, over the week.
 
N

NightWarrior

Guest
Well this program is ours first using call-by-reference variables so I might be overusing them. But the error says something concerning an .obj and .exe. I'm gonna work on it a little more, over the week.

So its a compiler error then? Something must be wrong in your .h file, if your using one.
 

NicAuf

Active Member
Messages
3,136
Reaction score
0
Tokenz
0.00z
I figured out what was wrong, the only thing I can't get now is it to compute right and display the student's name the second time. I'm gonna work on them, I'll use the debugger see if that helps.
 
N

NightWarrior

Guest
I figured out what was wrong, the only thing I can't get now is it to compute right and display the student's name the second time. I'm gonna work on them, I'll use the debugger see if that helps.

Cool. Good luck.
 

NicAuf

Active Member
Messages
3,136
Reaction score
0
Tokenz
0.00z
Ok so I ran the debugger and went through my program, and fixed some stuff. Now the only problem I'm having is in the calculation of the GPA. I think it has to do with the courses. I think once I put in a new letter grade for one course it wipes out the grades from the previous course. Any thoughts?

Updated C++ code: YourFileHost.com - Free hosting for ALL your files S4
 
N

NightWarrior

Guest
Ok so I ran the debugger and went through my program, and fixed some stuff. Now the only problem I'm having is in the calculation of the GPA. I think it has to do with the courses. I think once I put in a new letter grade for one course it wipes out the grades from the previous course. Any thoughts?

Updated C++ code: YourFileHost.com - Free hosting for ALL your files S4

This is what happens when you pass around a pointer to a memory location. You have a do-while loop and you just keep overwriting whats there.

You are going to have to call your functions to convert the letter to points inside GetLetterGrade(). Think about it for a bit, it will come to you.
 

NicAuf

Active Member
Messages
3,136
Reaction score
0
Tokenz
0.00z
I'm still having trouble computing the GPA, all it outputs is the numerical grade for each letter grade. I'm not sure how to fix it.
 
78,874Threads
2,185,387Messages
4,959Members
Back
Top