Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Introduction to Wireless and Mobile Systems

Authors: Dharma P. Agrawal, Qing An Zeng

4th edition

1305087135, 978-1305087132, 9781305259621, 1305259629, 9781305537910 , 978-130508713

More Books

Students also viewed these Programming questions

Question

What is the purpose of a firewall?

Answered: 1 week ago

Question

What is the difference between a CPU and a GPU?

Answered: 1 week ago

Question

What are the various principles of material handling ?

Answered: 1 week ago