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.

 ``12345678910111213141516171819202122232425262728293031323334353637383940`` ``````#include 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):
 ``1234567891011121314`` ``````#include 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.