fork download
  1. //********************************************************
  2. //
  3. // Assignment 8 - Pointers
  4. //
  5. // Name: Heather Grothe
  6. //
  7. // Class: C Programming, Spring 2026
  8. //
  9. // Date: April 2, 2026
  10. //
  11. // Description: Program which determines overtime and
  12. // gross pay for a set of employees with outputs sent
  13. // to standard output (the screen).
  14. //
  15. // This assignment also adds the employee name, their tax state,
  16. // and calculates the state tax, federal tax, and net pay. It
  17. // also calculates totals, averages, minimum, and maximum values.
  18. //
  19. // Pointer design
  20. //
  21. //********************************************************
  22.  
  23. // necessary header files
  24. #include <stdio.h>
  25. #include <string.h>
  26. #include <ctype.h>
  27.  
  28. // define constants
  29. #define SIZE 5
  30. #define STD_HOURS 40.0
  31. #define OT_RATE 1.5
  32. #define MA_TAX_RATE 0.05
  33. #define NH_TAX_RATE 0.0
  34. #define VT_TAX_RATE 0.06
  35. #define CA_TAX_RATE 0.07
  36. #define DEFAULT_TAX_RATE 0.08
  37. #define NAME_SIZE 20
  38. #define TAX_STATE_SIZE 3
  39. #define FED_TAX_RATE 0.25
  40. #define FIRST_NAME_SIZE 10
  41. #define LAST_NAME_SIZE 10
  42.  
  43. // Define a structure type to store an employee name
  44. struct name
  45. {
  46. char firstName[FIRST_NAME_SIZE];
  47. char lastName [LAST_NAME_SIZE];
  48. };
  49.  
  50. // Define a structure type to pass employee data between functions
  51. struct employee
  52. {
  53. struct name empName;
  54. char taxState [TAX_STATE_SIZE];
  55. long int clockNumber;
  56. float wageRate;
  57. float hours;
  58. float overtimeHrs;
  59. float grossPay;
  60. float stateTax;
  61. float fedTax;
  62. float netPay;
  63. };
  64.  
  65. // this structure type defines the totals of all floating point items
  66. struct totals
  67. {
  68. float total_wageRate;
  69. float total_hours;
  70. float total_overtimeHrs;
  71. float total_grossPay;
  72. float total_stateTax;
  73. float total_fedTax;
  74. float total_netPay;
  75. };
  76.  
  77. // this structure type defines the min and max values of all floating
  78. // point items so they can be display in our final report
  79. struct min_max
  80. {
  81. float min_wageRate;
  82. float min_hours;
  83. float min_overtimeHrs;
  84. float min_grossPay;
  85. float min_stateTax;
  86. float min_fedTax;
  87. float min_netPay;
  88. float max_wageRate;
  89. float max_hours;
  90. float max_overtimeHrs;
  91. float max_grossPay;
  92. float max_stateTax;
  93. float max_fedTax;
  94. float max_netPay;
  95. };
  96.  
  97. // define prototypes here for each function except main
  98. float getHours (long int clockNumber);
  99. float calcOvertimeHrs (float hours);
  100. float calcGrossPay (float wageRate, float hours, float overtimeHrs);
  101. void printHeader (void);
  102.  
  103. void printEmp (struct employee * emp_ptr);
  104.  
  105. float calcStateTax (float grossPay, char taxState[]);
  106. float calcFedTax (float grossPay);
  107. float calcNetPay (float grossPay, float stateTax, float fedTax);
  108.  
  109. void calcEmployeeTotals (struct employee * emp_ptr,
  110. struct totals * emp_totals_ptr);
  111.  
  112. void calcEmployeeMinMax (struct employee * emp_ptr,
  113. struct min_max * emp_minMax_ptr,
  114. int arrayIndex);
  115.  
  116. void printEmpStatistics (struct totals * emp_totals_ptr,
  117. struct min_max * emp_minMax_ptr,
  118. int theSize);
  119.  
  120. int main ()
  121. {
  122.  
  123. int i; // loop and array index
  124.  
  125. // Set up a local variable to store the employee information
  126. // Initialize the name, tax state, clock number, and wage rate
  127. struct employee employeeData[SIZE] = {
  128. { {"Connie", "Cobol"}, "MA", 98401, 10.60},
  129. { {"Mary", "Apl"}, "NH", 526488, 9.75 },
  130. { {"Frank", "Fortran"}, "VT", 765349, 10.50 },
  131. { {"Jeff", "Ada"}, "NY", 34645, 12.25 },
  132. { {"Anton", "Pascal"},"CA",127615, 8.35 }
  133. };
  134.  
  135. // pointer to the array of employee structures
  136. struct employee * emp_ptr;
  137.  
  138. // set the pointer to point to the array of employees
  139. emp_ptr = employeeData;
  140.  
  141. // set up structure to store totals and initialize all to zero
  142. struct totals employeeTotals = {0,0,0,0,0,0,0};
  143.  
  144. // pointer to the employeeTotals structure
  145. struct totals * emp_totals_ptr = &employeeTotals;
  146.  
  147. // set up structure to store min and max values and initialize all to zero
  148. struct min_max employeeMinMax = {0,0,0,0,0,0,0,0,0,0,0,0,0,0};
  149.  
  150. // pointer to the employeeMinMax structure
  151. struct min_max * emp_minMax_ptr = &employeeMinMax;
  152.  
  153. // Call functions as needed to read and calculate information
  154. for (i = 0; i < SIZE; ++i)
  155. {
  156.  
  157. // Prompt for the number of hours worked by the employee
  158. (emp_ptr + i)->hours = getHours ((emp_ptr + i)->clockNumber);
  159.  
  160. // Calculate the overtime hours
  161. (emp_ptr + i)->overtimeHrs = calcOvertimeHrs ((emp_ptr + i)->hours);
  162.  
  163. // Calculate the weekly gross pay
  164. (emp_ptr + i)->grossPay = calcGrossPay ((emp_ptr + i)->wageRate,
  165. (emp_ptr + i)->hours,
  166. (emp_ptr + i)->overtimeHrs);
  167.  
  168. // Calculate the state tax
  169. (emp_ptr + i)->stateTax = calcStateTax ((emp_ptr + i)->grossPay,
  170. (emp_ptr + i)->taxState);
  171.  
  172. // Calculate the federal tax
  173. (emp_ptr + i)->fedTax = calcFedTax ((emp_ptr + i)->grossPay);
  174.  
  175. // Calculate the net pay after taxes
  176. (emp_ptr + i)->netPay = calcNetPay ((emp_ptr + i)->grossPay,
  177. (emp_ptr + i)->stateTax,
  178. (emp_ptr + i)->fedTax);
  179.  
  180. // Keep a running sum of the employee totals
  181. calcEmployeeTotals ((emp_ptr + i), emp_totals_ptr);
  182.  
  183. // Keep a running update of the employee minimum and maximum values
  184. calcEmployeeMinMax ((emp_ptr + i), emp_minMax_ptr, i);
  185.  
  186. } // for
  187.  
  188. // Print the column headers
  189. printHeader();
  190.  
  191. // print out final information on each employee
  192. for (i = 0; i < SIZE; ++i)
  193. {
  194. printEmp (emp_ptr + i);
  195. } // for
  196.  
  197. // print the totals and averages for all float items
  198. printEmpStatistics (emp_totals_ptr, emp_minMax_ptr, SIZE);
  199.  
  200. return (0); // success
  201.  
  202. } // main
  203.  
  204. //**************************************************************
  205. // Function: getHours
  206. //
  207. // Purpose: Obtains input from user, the number of hours worked
  208. // per employee and stores the result in a local variable
  209. // that is passed back to the calling function.
  210. //
  211. // Parameters:
  212. //
  213. // clockNumber - The unique employee ID
  214. //
  215. // Returns: theHoursWorked - hours worked in a given week
  216. //
  217. //**************************************************************
  218.  
  219. float getHours (long int clockNumber)
  220. {
  221.  
  222. float theHoursWorked; // hours worked in a given week
  223.  
  224. // Read in hours for employee
  225. printf("\nEnter hours worked by emp # %06li: ", clockNumber);
  226. scanf ("%f", &theHoursWorked);
  227.  
  228. // return hours back to the calling function
  229. return (theHoursWorked);
  230.  
  231. } // getHours
  232.  
  233. //**************************************************************
  234. // Function: printHeader
  235. //
  236. // Purpose: Prints the initial table header information.
  237. //
  238. // Parameters: none
  239. //
  240. // Returns: void
  241. //
  242. //**************************************************************
  243.  
  244. void printHeader (void)
  245. {
  246.  
  247. printf ("\n\n*** Pay Calculator ***\n");
  248.  
  249. // print the table header
  250. printf("\n--------------------------------------------------------------");
  251. printf("-------------------");
  252. printf("\nName Tax Clock# Wage Hours OT Gross State Fed Net");
  253. printf("\n State Pay Tax Tax Pay");
  254. printf("\n--------------------------------------------------------------");
  255. printf("-------------------");
  256.  
  257. } // printHeader
  258.  
  259. //*************************************************************
  260. // Function: printEmp
  261. //
  262. // Purpose: Prints out all the information for an employee
  263. // in a nice and orderly table format.
  264. //
  265. // Parameters:
  266. //
  267. // emp_ptr - pointer to one employee structure
  268. //
  269. // Returns: void
  270. //
  271. //**************************************************************
  272.  
  273. void printEmp (struct employee * emp_ptr)
  274. {
  275.  
  276. // Used to format the employee name
  277. char name [FIRST_NAME_SIZE + LAST_NAME_SIZE + 2];
  278.  
  279. strcpy (name, emp_ptr->empName.firstName);
  280. strcat (name, " ");
  281. strcat (name, emp_ptr->empName.lastName);
  282.  
  283. // Print out a single employee
  284. printf("\n%-20.20s %-2.2s %06li %5.2f %4.1f %4.1f %7.2f %6.2f %7.2f %8.2f",
  285. name, emp_ptr->taxState, emp_ptr->clockNumber, emp_ptr->wageRate, emp_ptr->hours,
  286. emp_ptr->overtimeHrs, emp_ptr->grossPay, emp_ptr->stateTax, emp_ptr->fedTax, emp_ptr->netPay);
  287.  
  288. } // printEmp
  289.  
  290. //*************************************************************
  291. // Function: printEmpStatistics
  292. //
  293. // Purpose: Prints out the totals and averages of all
  294. // floating point value items for all employees
  295. // that have been processed.
  296. //
  297. // Parameters:
  298. //
  299. // emp_totals_ptr - pointer to a structure containing a running total
  300. // of all employee floating point items
  301. // emp_minMax_ptr - pointer to a structure containing all the minimum
  302. // and maximum values of all employee
  303. // floating point items
  304. // theSize - the total number of employees processed, used
  305. // to check for zero or negative divide condition.
  306. //
  307. // Returns: void
  308. //
  309. //**************************************************************
  310.  
  311. void printEmpStatistics (struct totals * emp_totals_ptr,
  312. struct min_max * emp_minMax_ptr,
  313. int theSize)
  314. {
  315.  
  316. // print a separator line
  317. printf("\n--------------------------------------------------------------");
  318. printf("-------------------");
  319.  
  320. // print the totals for all the floating point fields
  321. printf("\nTotals: %5.2f %5.1f %5.1f %7.2f %6.2f %7.2f %8.2f",
  322. emp_totals_ptr->total_wageRate,
  323. emp_totals_ptr->total_hours,
  324. emp_totals_ptr->total_overtimeHrs,
  325. emp_totals_ptr->total_grossPay,
  326. emp_totals_ptr->total_stateTax,
  327. emp_totals_ptr->total_fedTax,
  328. emp_totals_ptr->total_netPay);
  329.  
  330. // make sure you don't divide by zero or a negative number
  331. if (theSize > 0)
  332. {
  333. // print the averages for all the floating point fields
  334. printf("\nAverages: %5.2f %5.1f %5.1f %7.2f %6.2f %7.2f %8.2f",
  335. emp_totals_ptr->total_wageRate/theSize,
  336. emp_totals_ptr->total_hours/theSize,
  337. emp_totals_ptr->total_overtimeHrs/theSize,
  338. emp_totals_ptr->total_grossPay/theSize,
  339. emp_totals_ptr->total_stateTax/theSize,
  340. emp_totals_ptr->total_fedTax/theSize,
  341. emp_totals_ptr->total_netPay/theSize);
  342. } // if
  343.  
  344. // print the min values
  345. printf("\nMinimum: %5.2f %5.1f %5.1f %7.2f %6.2f %7.2f %8.2f",
  346. emp_minMax_ptr->min_wageRate,
  347. emp_minMax_ptr->min_hours,
  348. emp_minMax_ptr->min_overtimeHrs,
  349. emp_minMax_ptr->min_grossPay,
  350. emp_minMax_ptr->min_stateTax,
  351. emp_minMax_ptr->min_fedTax,
  352. emp_minMax_ptr->min_netPay);
  353.  
  354. // print the max values
  355. printf("\nMaximum: %5.2f %5.1f %5.1f %7.2f %6.2f %7.2f %8.2f",
  356. emp_minMax_ptr->max_wageRate,
  357. emp_minMax_ptr->max_hours,
  358. emp_minMax_ptr->max_overtimeHrs,
  359. emp_minMax_ptr->max_grossPay,
  360. emp_minMax_ptr->max_stateTax,
  361. emp_minMax_ptr->max_fedTax,
  362. emp_minMax_ptr->max_netPay);
  363.  
  364. } // printEmpStatistics
  365.  
  366. //*************************************************************
  367. // Function: calcOvertimeHrs
  368. //
  369. // Purpose: Calculates the overtime hours worked by an employee
  370. // in a given week.
  371. //
  372. // Parameters:
  373. //
  374. // hours - Hours worked in a given week
  375. //
  376. // Returns: theOvertimeHrs - overtime hours worked by an employee
  377. // in a given week
  378. //
  379. //**************************************************************
  380.  
  381. float calcOvertimeHrs (float hours)
  382. {
  383.  
  384. float theOvertimeHrs; // calculated overtime hours for employee
  385.  
  386. // Any overtime ?
  387. if (hours >= STD_HOURS)
  388. {
  389. theOvertimeHrs = hours - STD_HOURS;
  390. }//if
  391. else
  392. {
  393. theOvertimeHrs = 0;
  394. }//else
  395.  
  396. // return overtime hours back to the calling function
  397. return (theOvertimeHrs);
  398.  
  399. } // calcOvertimeHrs
  400.  
  401. //*************************************************************
  402. // Function: calcGrossPay
  403. //
  404. // Purpose: Calculates the gross pay based on the the normal pay
  405. // and any overtime pay for a given week.
  406. //
  407. // Parameters:
  408. //
  409. // wageRate - the hourly wage rate
  410. // hours - the hours worked in a given week
  411. // overtimeHrs - hours worked above normal hours
  412. //
  413. // Returns: theGrossPay - total weekly gross pay for an employee
  414. //
  415. //**************************************************************
  416.  
  417. float calcGrossPay (float wageRate, float hours, float overtimeHrs)
  418. {
  419.  
  420. float theGrossPay; // gross pay earned in a given week
  421. float theNormalPay; // normal pay without any overtime hours
  422. float theOvertimePay; // overtime pay
  423.  
  424. // calculate normal pay and any overtime pay
  425. theNormalPay = wageRate * (hours - overtimeHrs);
  426. theOvertimePay = overtimeHrs * (OT_RATE * wageRate);
  427.  
  428. // calculate gross pay for employee as normalPay + any overtime pay
  429. theGrossPay = theNormalPay + theOvertimePay;
  430.  
  431. // return the calculated gross pay value back
  432. return (theGrossPay);
  433.  
  434. } // calcGrossPay
  435.  
  436. //*************************************************************
  437. // Function: calcStateTax
  438. //
  439. // Purpose: Calculates the State Tax owed based on gross pay
  440. //
  441. // Parameters:
  442. //
  443. // grossPay - the grossPay for a given week
  444. // taxState - the physical state where the employee works
  445. //
  446. // Returns: theStateTax - calculated state tax owed
  447. //
  448. //**************************************************************
  449.  
  450. float calcStateTax (float grossPay, char taxState[])
  451. {
  452.  
  453. float theStateTax; // calculated state tax
  454.  
  455. theStateTax = grossPay;
  456.  
  457. // Make sure tax state is all uppercase
  458. if (islower(taxState[0]))
  459. {
  460. taxState[0] = toupper(taxState[0]);
  461. }//if
  462.  
  463. if (islower(taxState[1]))
  464. {
  465. taxState[1] = toupper(taxState[1]);
  466. }//if
  467.  
  468. // calculate state tax based on where employee resides
  469. if (strcmp(taxState, "MA") == 0)
  470. {
  471. theStateTax *= MA_TAX_RATE;
  472. }//if
  473. else if (strcmp(taxState, "NH") == 0)
  474. {
  475. theStateTax *= NH_TAX_RATE;
  476. }//else if
  477. else if (strcmp(taxState, "VT") == 0)
  478. {
  479. theStateTax *= VT_TAX_RATE;
  480. }//else if
  481. else if (strcmp(taxState, "CA") == 0)
  482. {
  483. theStateTax *= CA_TAX_RATE;
  484. }//else if
  485. else
  486. {
  487. theStateTax *= DEFAULT_TAX_RATE;
  488. }//else
  489.  
  490. // return the calculated state tax back
  491. return (theStateTax);
  492.  
  493. } // calcStateTax
  494.  
  495. //*************************************************************
  496. // Function: calcFedTax
  497. //
  498. // Purpose: Calculates the Federal Tax owed based on the gross
  499. // pay
  500. //
  501. // Parameters:
  502. //
  503. // grossPay - the grossPay for a given week
  504. //
  505. // Returns: theFedTax - calculated federal tax owed
  506. //
  507. //**************************************************************
  508.  
  509. float calcFedTax (float grossPay)
  510. {
  511.  
  512. float theFedTax; // The calculated Federal Tax
  513.  
  514. // Fed Tax is the same for all regardless of state
  515. theFedTax = grossPay * FED_TAX_RATE;
  516.  
  517. // return the calculated federal tax back
  518. return (theFedTax);
  519.  
  520. } // calcFedTax
  521.  
  522. //*************************************************************
  523. // Function: calcNetPay
  524. //
  525. // Purpose: Calculates the net pay as the gross pay minus any
  526. // state and federal taxes owed. Essentially, your
  527. // "take home" pay.
  528. //
  529. // Parameters:
  530. //
  531. // grossPay - the grossPay for a given week
  532. // stateTax - the state taxes owed
  533. // fedTax - the fed taxes owed
  534. //
  535. // Returns: theNetPay - calculated take home pay (minus taxes)
  536. //
  537. //**************************************************************
  538.  
  539. float calcNetPay (float grossPay, float stateTax, float fedTax)
  540. {
  541.  
  542. float theNetPay; // total take home pay (minus taxes)
  543. float theTotalTaxes; // total taxes owed
  544.  
  545. // calculate the total state and federal taxes
  546. theTotalTaxes = stateTax + fedTax;
  547.  
  548. // calculate the net pay
  549. theNetPay = grossPay - theTotalTaxes;
  550.  
  551. // return the calculated net pay back
  552. return (theNetPay);
  553.  
  554. } // calcNetPay
  555.  
  556. //*************************************************************
  557. // Function: calcEmployeeTotals
  558. //
  559. // Purpose: Accepts a pointer to one employee structure and
  560. // adds the float values to a running total.
  561. //
  562. // Parameters:
  563. //
  564. // emp_ptr - pointer to current employee structure
  565. // emp_totals_ptr - pointer to structure containing running totals
  566. //
  567. // Returns: void
  568. //
  569. //**************************************************************
  570.  
  571. void calcEmployeeTotals (struct employee * emp_ptr,
  572. struct totals * emp_totals_ptr)
  573. {
  574.  
  575. // add current employee data to our running totals
  576. emp_totals_ptr->total_wageRate += emp_ptr->wageRate;
  577. emp_totals_ptr->total_hours += emp_ptr->hours;
  578. emp_totals_ptr->total_overtimeHrs += emp_ptr->overtimeHrs;
  579. emp_totals_ptr->total_grossPay += emp_ptr->grossPay;
  580. emp_totals_ptr->total_stateTax += emp_ptr->stateTax;
  581. emp_totals_ptr->total_fedTax += emp_ptr->fedTax;
  582. emp_totals_ptr->total_netPay += emp_ptr->netPay;
  583.  
  584. } // calcEmployeeTotals
  585.  
  586. //*************************************************************
  587. // Function: calcEmployeeMinMax
  588. //
  589. // Purpose: Accepts a pointer to one employee structure and
  590. // updates the running min and max values.
  591. //
  592. // Parameters:
  593. //
  594. // emp_ptr - pointer to current employee structure
  595. // emp_minMax_ptr - pointer to structure containing min and max values
  596. // arrayIndex - current employee array index
  597. //
  598. // Returns: void
  599. //
  600. //**************************************************************
  601.  
  602. void calcEmployeeMinMax (struct employee * emp_ptr,
  603. struct min_max * emp_minMax_ptr,
  604. int arrayIndex)
  605. {
  606.  
  607. // if this is the first set of data items, set
  608. // them to the min and max
  609. if (arrayIndex == 0)
  610. {
  611. emp_minMax_ptr->min_wageRate = emp_ptr->wageRate;
  612. emp_minMax_ptr->min_hours = emp_ptr->hours;
  613. emp_minMax_ptr->min_overtimeHrs = emp_ptr->overtimeHrs;
  614. emp_minMax_ptr->min_grossPay = emp_ptr->grossPay;
  615. emp_minMax_ptr->min_stateTax = emp_ptr->stateTax;
  616. emp_minMax_ptr->min_fedTax = emp_ptr->fedTax;
  617. emp_minMax_ptr->min_netPay = emp_ptr->netPay;
  618.  
  619. emp_minMax_ptr->max_wageRate = emp_ptr->wageRate;
  620. emp_minMax_ptr->max_hours = emp_ptr->hours;
  621. emp_minMax_ptr->max_overtimeHrs = emp_ptr->overtimeHrs;
  622. emp_minMax_ptr->max_grossPay = emp_ptr->grossPay;
  623. emp_minMax_ptr->max_stateTax = emp_ptr->stateTax;
  624. emp_minMax_ptr->max_fedTax = emp_ptr->fedTax;
  625. emp_minMax_ptr->max_netPay = emp_ptr->netPay;
  626.  
  627. }// if
  628.  
  629. else if (arrayIndex >=1) // process if other array elements
  630. {
  631. // check if current Wage Rate is the new min and/or max
  632. if (emp_ptr->wageRate < emp_minMax_ptr->min_wageRate)
  633. {
  634. emp_minMax_ptr->min_wageRate = emp_ptr->wageRate;
  635. }//if
  636.  
  637. if (emp_ptr->wageRate > emp_minMax_ptr->max_wageRate)
  638. {
  639. emp_minMax_ptr->max_wageRate = emp_ptr->wageRate;
  640. }//if
  641.  
  642. if (emp_ptr->hours < emp_minMax_ptr->min_hours)
  643. {
  644. emp_minMax_ptr->min_hours = emp_ptr->hours;
  645. }//if
  646.  
  647. if (emp_ptr->hours > emp_minMax_ptr->max_hours)
  648. {
  649. emp_minMax_ptr->max_hours = emp_ptr->hours;
  650. }//if
  651.  
  652. if (emp_ptr->overtimeHrs < emp_minMax_ptr->min_overtimeHrs)
  653. {
  654. emp_minMax_ptr->min_overtimeHrs = emp_ptr->overtimeHrs;
  655. }//if
  656.  
  657. if (emp_ptr->overtimeHrs > emp_minMax_ptr->max_overtimeHrs)
  658. {
  659. emp_minMax_ptr->max_overtimeHrs = emp_ptr->overtimeHrs;
  660. }//if
  661.  
  662. if (emp_ptr->grossPay < emp_minMax_ptr->min_grossPay)
  663. {
  664. emp_minMax_ptr->min_grossPay = emp_ptr->grossPay;
  665. }//if
  666.  
  667. if (emp_ptr->grossPay > emp_minMax_ptr->max_grossPay)
  668. {
  669. emp_minMax_ptr->max_grossPay = emp_ptr->grossPay;
  670. }//if
  671.  
  672. if (emp_ptr->stateTax < emp_minMax_ptr->min_stateTax)
  673. {
  674. emp_minMax_ptr->min_stateTax = emp_ptr->stateTax;
  675. }//if
  676.  
  677. if (emp_ptr->stateTax > emp_minMax_ptr->max_stateTax)
  678. {
  679. emp_minMax_ptr->max_stateTax = emp_ptr->stateTax;
  680. }//if
  681.  
  682. if (emp_ptr->fedTax < emp_minMax_ptr->min_fedTax)
  683. {
  684. emp_minMax_ptr->min_fedTax = emp_ptr->fedTax;
  685. }//if
  686.  
  687. if (emp_ptr->fedTax > emp_minMax_ptr->max_fedTax)
  688. {
  689. emp_minMax_ptr->max_fedTax = emp_ptr->fedTax;
  690. }//if
  691.  
  692. if (emp_ptr->netPay < emp_minMax_ptr->min_netPay)
  693. {
  694. emp_minMax_ptr->min_netPay = emp_ptr->netPay;
  695. }//if
  696.  
  697. if (emp_ptr->netPay > emp_minMax_ptr->max_netPay)
  698. {
  699. emp_minMax_ptr->max_netPay = emp_ptr->netPay;
  700. }//if
  701.  
  702. }//else if
  703.  
  704. } // calcEmployeeMinMax
Success #stdin #stdout 0s 5320KB
stdin
 51.0   
 42.5
 37.0
 45.0
 40.0
stdout
Enter hours worked by emp # 098401: 
Enter hours worked by emp # 526488: 
Enter hours worked by emp # 765349: 
Enter hours worked by emp # 034645: 
Enter hours worked by emp # 127615: 

*** Pay Calculator ***

---------------------------------------------------------------------------------
Name                Tax  Clock#  Wage   Hours  OT   Gross   State  Fed      Net
                   State                            Pay     Tax    Tax      Pay
---------------------------------------------------------------------------------
Connie Cobol         MA  098401 10.60  51.0  11.0  598.90  29.95  149.73   419.23
Mary Apl             NH  526488  9.75  42.5   2.5  426.56   0.00  106.64   319.92
Frank Fortran        VT  765349 10.50  37.0   0.0  388.50  23.31   97.12   268.07
Jeff Ada             NY  034645 12.25  45.0   5.0  581.88  46.55  145.47   389.86
Anton Pascal         CA  127615  8.35  40.0   0.0  334.00  23.38   83.50   227.12
---------------------------------------------------------------------------------
Totals:                          51.45 215.5  18.5 2329.84 123.18  582.46  1624.19
Averages:                        10.29  43.1   3.7  465.97  24.64  116.49   324.84
Minimum:                          8.35  37.0   0.0  334.00   0.00   83.50   227.12
Maximum:                         12.25  51.0  11.0  598.90  46.55  149.73   419.23