Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Can someone tell me what i am missing on this code??? Sorry it doesn't make sense to me. I am new to programming. #include /*

Can someone tell me what i am missing on this code??? Sorry it doesn't make sense to me. I am new to programming.

#include

/* constants */

#define NUM_EMPL 5

#define OVERTIME_RATE 1.5f

#define STD_WORK_WEEK 40.0f

/* function prototypes */

float getHours (long int clockNumber);

void printHeader (void);

void printEmp (long int clockNumber, float wageRate, float hours,

float overtimeHrs, float grossPay);

/* TODO: Add other function prototypes here as needed */

int main()

{

/* Variable Declarations */

long int clockNumber[NUM_EMPL] = {98401,526488,765349,34645,127615}; /* ID */

float grossPay[NUM_EMPL]; /* gross pay */

float hours[NUM_EMPL]; /* hours worked in a given week */

int i; /* loop and array index */

float overtimeHrs[NUM_EMPL]; /* overtime hours */

float wageRate[NUM_EMPL] = {10.60,9.75,10.50,12.25,8.35}; /* hourly wage rate */

/* process each employee */

for (i = 0; i < NUM_EMPL; ++i)

{

/* Read in the hours for an employee */

hours[i] = getHours (clockNumber[i]);

/* TODO: Function call to calculate overtime */

/* TODO: Function call to calculate gross pay */

}

/* print the header info */

printHeader();

/* print out each employee */

for (i = 0; i < NUM_EMPL; ++i)

{

/* Print all the employees - call by reference */

printEmp (clockNumber[i], wageRate[i], hours[i],

overtimeHrs[i], grossPay[i]);

} /* for */

return (0);

}

//**************************************************************

// Function: getHours

//

// Purpose: Obtains input from user, the number of hours worked

// per employee and stores the result in a local variable

// that is passed back to the calling function.

//

// Parameters: clockNumber - The unique employee ID

//

// Returns: hoursWorked - hours worked in a given week

//

//**************************************************************

float getHours (long int clockNumber)

{

float hoursWorked; /* hours worked in a given week */

/* Read in hours for employee */

printf(" Enter hours worked by emp # %06li: ", clockNumber);

scanf ("%f", &hoursWorked);

/* return hours back to the calling function */

return (hoursWorked);

}

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

Microsoft SQL Server 2012 Unleashed

Authors: Ray Rankins, Paul Bertucci

1st Edition

0133408507, 9780133408508

More Books

Students also viewed these Databases questions