Structures

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

**
** HOMEWORK: #5 Structures
**
** Name: [Enter your Name]
**
** Class: C Programming
**
** Date: [enter the date]
**
** Description: This program prompts the user for the number of hours
** worked for each employee. It then calculates gross pay
** including overtime and displays the results in table. Functions
** and structures are used.
**
/**********************************************************************/

Save your time - order a paper!

Get your paper written from scratch within the tight deadline. Our service is a reliable solution to all your troubles. Place an order on any task and we will take care of it. You won’t have to worry about the quality and deadlines

Order Paper Now

/*Define and Includes */

#include <stdio.h>

/* Define Constants */
#define NUM_EMPL 5

/* Define a global structure to pass employee data between functions */
/* Note that the structure type is global, but you don’t want a variable */
/* of that type to be global. Best to declare a variable of that type */
/* in a function like main or another function and pass as needed. */

struct employee
{
long id_number;
float wage;
float hours;
float overtime;
float gross;
};

/* define prototypes here for each function except main */

void Output_Results_Screen (struct employee emp [ ], int size);

/* add your functions here */

/********************************************************************
** Function: Output_Results_Screen
**
** Purpose: Outputs to screen in a table format the following
** information about an employee: Clock, Wage,
** Hours, Overtime, and Gross Pay.
**
** Parameters:
**
** employeeData – an array of structures containing
** employee information
** size – number of employees to process
**
** Returns: Nothing (void)
**
********************************************************************/

void Output_Results_Screen ( struct employee employeeData[], int size )
{
int i; /* loop index */

/* print information about each employee */
for (i = 0; i < size ; ++i)
{
printf(” %06li %5.2f %4.1f %4.1f %8.2f n”,
employeeData[i].id_number, employeeData[i].wage, employeeData[i].hours,
employeeData[i].overtime, employeeData[i].gross);
} /* for */

} /* Output_results_screen */

int main ()
{
/* Set up a local variable and initialize the clock and wages of my employees */
struct employee employeeData[NUM_EMPL] = {
{ 98401, 10.60 },
{ 526488, 9.75 },
{ 765349, 10.50 },
{ 34645, 12.25 },
{ 127615, 8.35 }
};

/* Call various functions needed to read and calculate info */

/* Print the column headers */

/* Function call to output results to the screen in table format. */
Output_Results_Screen (employeeData, NUM_EMPL);

return(0); /* success */

} /* main */

 
Do you need a similar assignment done for you from scratch? We have qualified writers to help you. We assure you an A+ quality paper that is free from plagiarism. Order now for an Amazing Discount!
Use Discount Code "Newclient" for a 15% Discount!

NB: We do not resell papers. Upon ordering, we do an original paper exclusively for you.