Question
Default Arguments. Employees of the Acme Widget Co. normally work 40 hours per week. Occasionally, when widget demand is high, employees work overtime. Overtime hours
Default Arguments. Employees of the Acme Widget Co. normally work 40 hours per week.
Occasionally, when widget demand is high, employees work overtime. Overtime hours are paid at
50% more than the normal hourly rate. Write C++ program that uses a function, wage, to determine
an employee's weekly wages. The function should have two parameters: The employee's wage rate
and the employee's number of overtime hours worked. The second parameter should have an
appropriate default value. The program should repeatedly do these tasks: Read in an employee's
name and wage rate and ask if the employee worked overtime. For an employee who did not work
overtime, the program should call the wage function, using its default parameter value, to obtain the
employee's wages. Otherwise, the program should prompt for and read the number of overtime
hours and then call the wage function, using both parameters, to obtain the employee's wages. Then,
the program should display the employee's name and their wages, and then ask if the user wishes to
continue.
Here is an example of what output should look like from running your program (user input is shown
in bold):
Name: John Doe
Enter rate: $15
Overtime? (y or n): y
Enter overtime hours: 20
Name: John Doe Wages: $1050.00
Enter another? (y or n): y
Name: Mary Smith
Enter rate: $20
Overtime? (y or n): n
Name: Mary Smith Wages: $800.00
Enter another? (y or n): n
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started