I am in the second semester of computer programming and am not so familiar with functions. Arrays I know but don't know how to use them in functions either.

I am looking for someone who can help me with the following:

The problem is as follows:

Read two numbers, representing a rate of pay ($ per hour) and a number of hours. Print out the total pay, with hours up to 40 being paid at a basic rate, from 40 to 60 at a rate-and-a-half, above 60 at double-rate. Print the pay as $ to 2 decimal places.

Terminate the loop when a zero rate is encountered. At the end of the loop, print out total pay.

The code for computing the pay from the rate and hours is to be written as a function.

A loop , arrays and at least two functions should be used.

One function for calculation and another for printing the total pay.

The output format should look something like this:

Pay at $2.10 / hr for 12 hours is $25.20

Pay at $2.20 /hr for 48 hours is $114.40

Pay at $2.40 / hr for 68 hours is $206.40

Pay at $2.60 / hr for 48 hours is $135.20

Pay at $2.80 / hr for 68 hours is $240.80

Pay at $3.00 / hr for 48 hours is $156.00

Total Pay is 928.80

I've tried to write the program without arrays, and it kind of works , but don't know how to use arrays and functions at the same time

This is how I started:

#include<stdio.h>

Double pay_calc(double[10], double rate[10]);

Double total_pay(double);

Main ()

{

double num1[10], num2[10];

double j=0;

for (j=0;j<10;j++){

printf("please enter hours for employee:",j+1);

scanf("%lf",&num1[j];}

for (j=0;j<10;j++){

printf("\nplease enter rate for employee:"j+1);

scanf("%lf",&num2[j]);}

if (num1[j]<0 || num2[j]<0)

printf("\nplease enter a positive value!!!");

return 0;

}

Double pay_calc(double hour[10], double[10])

{

double j=0, pay_calc[10];

for (j=0;j<10;j++){

if hour[j]>60

pay_calc=40*rate[j]+(60-40)*rate[j]*1.5+(hour[j]%60)*rate[j]*2

else if

hour[j]<=60

pay_calc=40*rate[j]+(hour[j]%40)*rate[j]*1.5

else if

hour[j]<=40

pay_calc=hour[j]*rate[j]

printf("\n\n Pay at %.2lf for %.2lf hours is %.2lf", rate[j],hour[j], pay_calc[j]);

}

return pay_calc[10];

}

Now I need another function that prints the total pay, how do I terminate the loop when a zero is entered?

PLEASE HELP ! ! ! Your urgent assistancewill be highly appreciated.