Question: / / necessary header files #include #include #include / / for char functions #include / / for malloc / / define constants #define STD _
necessary header files
#include
#include
#include for char functions
#include for malloc
define constants
#define STDHOURS
#define OTRATE
#define MATAXRATE
#define NHTAXRATE
#define VTTAXRATE
#define CATAXRATE
#define DEFAULTTAXRATE
#define NAMESIZE
#define TAXSTATESIZE
#define FEDTAXRATE
#define FIRSTNAMESIZE
#define LASTNAMESIZE
Define a global structure type to store an employee name
note how one could easily extend this to other parts
parts of a name: Middle, Nickname, Prefix, Suffix, etc.
struct name
char firstNameFIRSTNAMESIZE;
char lastName LASTNAMESIZE;
;
Define a global structure type 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.
Note the "next" member has been added as a pointer to structure employee.
This allows us to point to another data item of this same type,
allowing us to set up and traverse through all the linked
list nodes, with each node containing the employee information below.
struct employee
struct name empName;
char taxState TAXSTATESIZE;
long int clockNumber;
float wageRate;
float hours;
float overtimeHrs;
float grossPay;
float stateTax;
float fedTax;
float netPay;
struct employee next;
;
this structure type defines the totals of all floating point items
so they can be totaled and used also to calculate averages
struct totals
float totalwageRate;
float totalhours;
float totalovertimeHrs;
float totalgrossPay;
float totalstateTax;
float totalfedTax;
float totalnetPay;
;
this structure type defines the min and max values of all floating
point items so they can be display in our final report
struct minmax
float minwageRate;
float minhours;
float minovertimeHrs;
float mingrossPay;
float minstateTax;
float minfedTax;
float minnetPay;
float maxwageRate;
float maxhours;
float maxovertimeHrs;
float maxgrossPay;
float maxstateTax;
float maxfedTax;
float maxnetPay;
;
define prototypes here for each function except main
struct employee getEmpData void;
int isEmployeeSize struct employee headptr;
void calcOvertimeHrs struct employee headptr;
void calcGrossPay struct employee headptr;
void printHeader void;
void printEmp struct employee headptr;
void calcStateTax struct employee headptr;
void calcFedTax struct employee headptr;
void calcNetPay struct employee headptr;
void calcEmployeeTotals struct employee headptr
struct totals emptotalsptr;
void calcEmployeeMinMax struct employee headptr
struct minmax empminMaxptr;
void printEmpStatistics struct totals emptotalsptr
struct minmax empminMaxptr
int theSize;
int main
set up head pointer in the main function to point to the
start of the dynamically allocated linked list nodes that will be
created and stored in the Heap area.
struct employee headptr; always points to first linked list node
int theSize; number of employees processed
set up structure to store totals and initialize all to zero
struct totals employeeTotals ;
pointer to the employeeTotals structure
struct totals emptotalsptr &employeeTotals;
set up structure to store min and max values and initialize all to zero
struct
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
