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