logo CodeStepByStep logo

printPay

Language/Type: C++ parameters

Write a function named printPay that computes and prints the amount of money an employee should earn. Your function accepts two parameters: a real number for the employee's hourly salary, and an integer for the number of hours the employee worked. Every hour over 8 is paid at 1.5x the normal salary. For example, the call of printPay(10.00, 11); should print the following output:

Hours worked: 11
Pay earned: $125.00

You may assume that the value passed for the salary and hours are non-negative.

Type your C++ solution code here:


This is a function exercise. Write a C++ function as described. Do not write a complete program; just the function(s) above.

You must log in before you can solve this problem.

Log In

Need help?

If you do not understand how to solve an exercise or why your solution doesn't work, please contact your TA or instructor.
If something seems wrong with the site (errors, slow performance, incorrect tests, etc.), please

Is there a problem? Contact a site administrator.

©, all rights reserved.