Question
This is an example of overloading functions. Two functions are overloaded if the functions share a name but have different parameter lists. Each of the
This is an example of overloading functions. Two functions are overloaded if the functions share a name but have different parameter lists.
Each of the functions will accept from one to four parameters (floats) and calculate a gross pay. The gross pay is returned to the calling function
- float calcGrossPay(float salary)
return salary
- float calcGrossPay(float hours, float rate)
return hours * rate
- float calcGrossPay(float salary, float ot-hours, float ot-rate)
return salary + ot-hours * ot-rate
- float calcGrossPay(float hours, float rate, float ot-hours, float ot-rate)
return hours * rate + ot-hours * ot-rate
in main ask the user for
- salary
- hours
- pay rate
- over time hours
- overtime rate
call each of the overloaded functions with the proper arguments
output (these are the numbers you read in)
salary ??,???.00
hours ??.00
pay rate ???.00
over time hours ??.00
overtime rate ???.00
salary ??,???.00 // from function A
hourly pay ??.00 // from function B
salary + o/t ??,???.00 // from function C
hourly pay + o/t ??,???.00 // from function D
Use the output (cout) manipulators to format the output correctly [setw(?), fixed, right, left, etc]
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