Question: Using functional decomposition, write a program in C + + to read value for hours worked by six employees in a small company. And then

Using functional decomposition, write a program in C++ to read value for hours
worked by six employees in a small company. And then calculate the take home of
each employee. The hours worked by each employee will be stored in an array
called hours and the pay of each employee will be stored in the corresponding
position in another array called pay.
Here is snippet of the beginning of the program.
What you need to do?
a) Add a function prototype as shown below.
void getHours(double [],int);
where the first parameter is the array to store the hours worked and the
second parameter is for the size of the array.
#include =6=22.80
Then write the definition of the said function (getHours) and in this
function, you will prompt user to enter hours worked each week and store
each value to the array.
Test this function to make sure it works before proceed.
Write a statement in your main function to call this getHours function.
And after the call statement, write a loop in your main function to print each
value in the array. Make sure that the values printed are the values entered
in the function and they should be printed in the correct order.
b) Add another function prototype as shown below.
void calcPay(double [],double [],int);
where the first parameter is the array that contain hours worked by each
employee, the second parameter is the array that will store the pay, and the
third parameter is for the size of the array.
Then write the definition of the said function (calcPay) and in this
function, you will read each value from the hours array then calculate the
pay for that hour and store result to the pay array in the corresponding
position.
If hours worked is 40 or less then pay will be hours multiplied by the value
of BASE_RATE already defined.
If hours is more than 40 hours then you will need to calculate the overtime
pay which will be hours in excess of 40 multiplied by the BASE_RATE then
multiplied by 1.5
So if hours worked is 42, then the regular pay will be $912.00(40 x $22.80)
and overtime pay will be $68.40(2x$22.80x1.5). Hence, the total pay to be
stored in the array will be $982.40
Test this calcPay function to make sure it works before proceed.
Write a statement in your main function to call this calcPay function.
And after the call statement, write a loop in your main function to print each
value in the array. Make sure that the values printed are the values
calculated and stored in the function and they should be printed in the
correct order.
c) Add another function prototype as shown below.
void printPay(double [],int);
where the first parameter is the array that contains the pay, and the second
parameter is for the size of the array.
Then write the definition of the said function (printPay) and in this
function, you will simply print the value of the pay one value per line and put
$ in front. Make sure the values for cents are aligned correctly to the right
side.
Add pre-conditions and post-conditions documentation to your function.
Remember to use meaningful names for your variables.
 Using functional decomposition, write a program in C++ to read value

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!