Modifying my calc gross pay

I am having trouble modifying my piece of code to satisfy the instructions given to me. How can i start to correctly do this problem? The directions :

Design and code a new function that accepts as parameters the gross pay by value and the federal tax, state tax, local tax, SS tax, and net Pay by reference. Calculate the taxes at the following rates: federal – 14%, state – 6 %, local – 3.5%, and SS – 4.75%. Calculate the net pay as the gross less the taxes. Return the results via the parameters.
•Design and code a function to display all the gross to net values (as all are dollar amounts, show with 2 decimal places).
•Make the process repetitive until the user enters Cntl_z (eof).

This is how I started. Am I starting correctly?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include <iostream>
#include <cstdlib>
#include <iomanip>
using namespace std;
double getGrosspay (double payrate, double hours);
double Excesshours;
double getNet (double federal, double state, double local, double SS);

int main()
{

cout << fixed << showpoint << setprecision(2);

     double payrate, hours;
            cout << "Enter the payrate and hours: ";
            cin >> payrate >> hours; 

     double Grosspay = getGrosspay (payrate, hours);
            cout << "Grosspay amount is: $" << Grosspay << endl; 



system("pause");
return 0;

}

double getGrosspay (double payrate, double hours)
{
 double Grosspay;
        if (hours > 40)
        {
         Excesshours = hours - 40;
         Grosspay = (payrate * 1.5 * Excesshours) + (payrate * 40);
         }
         else
         {
         Grosspay = payrate * hours;
         }

return Grosspay;
}

double getNet (double federal, double state, double local, double SS)
{
       double Net; 
Note: You already had a thread for this: http://www.cplusplus.com/forum/beginner/119432/

According to your instructions, your getNet should take six parameters:
gross : by value
federal, state, local, SS, net : by reference

Your current version takes only four, and all by value.
how does one make it so that it takes six and go by either value or reference?
How did you write the current getNet function?

You did state in your other thread that you have looked at the tutorial page that describes "Arguments passed by value and by reference".


Unrelated notes:
* Excesshours should not be a global variable.
* while ( cin >> payrate >> hours ) { /*...*/ }
Topic archived. No new replies allowed.