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