Please help me with my homework?

I have a horrible professor and he gave us this assignment and I absolutely can't do it it's more difficult than the others.


1) Write the definition of the function getHoursRate that prompts the user to input the hours worked and rate per hour to initialize the variables hours and rate of the function main.
2) Write the definition of the value-returning function payCheck that calculates and returns the amount to be paid to an employee based on the hours worked and the rate per hour. The hours worked and rate per hour are stored in the variables hours and rate, respectively, of the function main. The formula for calculating the amount to be paid is as follows: For the first 40 hours the rate is the given rate; for the hours over 40, the rate is 1.5 times the given rate.
3) Write the definition of the function printCheck that prints (displays) the hours worked, rate per hour, and the salary.
4) Write the definition of the function main that tests each of these functions.

These are the instructions can you guys please help me write the code? I think I am supposed to use multiple functions and maybe void functions?
Thanks a lot guys
What did you do so far, and how much do you know?
Well Let me write what I have written so far so you can also see what we have studied.

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
#include <iostream>
using namespace std;

void getHours (double hours);
void getRate (double rate);
void getSalary (double amount);
int main()
{
double rate;
double hours;
double amount;

getHours(hours);

getRate(rate);

return 0;
}
void getHours (double hours)
{
cout << " Enter the hours worked. " << endl;
cin >> hours;
cout << endl;
}
void getRate (double rate)
{
cout << " Enter the rate per hour at which you get paid." << endl;
cin >> rate;
cout << endl;
}
void getSalary (double amount)
{
double hours;
double rate;
amount = hours * rate;

if (hours > 40)
amount = hours * (rate * 1.5);
cout << " The total salary is: " << amount << endl;
}
So far, so good. There's a small catch though (I'll let the code do the talking):
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include <iostream>

void change(int &i) // look up "pass by reference"
{
    i = -666;
}

int main()
{
    int number = 9000;

    change(number);
    std::cout << number << std::endl;
}
Topic archived. No new replies allowed.