Programming Exercise 12 "Design a new type called payroll" and Exercise 13 Write a Program that generates the weekly payroll In case you don't have the textbook, here are the problems (You can implement both in the same program, No need for two separate programs):

12.Design a new type called payrollT that is capable of holding the data for a list of employees, each of which is represented using the employeeT type introduced in the section on "Dynamic records" at the end of the chapter. The type payrollT should be a pointer type whose underlying value is a record containing the number of employees and a dynamic array of the actual employeeT values, as illustrated by the following data diagram: see image.

After writing the types that define this data structure, write a function GetPayroll that reads in a list of employees, as shown in the following sample run: see image.

After the input values have been entered, the GetPayroll function should return a value of type payrollT that matches the structure shown in the diagram.

13.Write a program that generates the weekly payroll for a company whose employment records are stored using the type payrollT, as defined in the preceding exercise. Each employee is paid the salary given in the employee record, after deducting taxes. Your program should compute taxes as follows:

  • Deduct $1 from the salary for each withholding exemption. This figure is the adjusted income. (If the result of the calculation is less than 0, use 0 as the adjusted income.)
  • Multiply the adjusted income by the tax rate, which you should assume is a flat 25 percent.

For example, Bob Cratchit has a weekly income of $15. Because he has seven dependents, his adjusted income is $15 - (7 x $1), or $8. Twenty-five percent of $8 is $2, so Mr. Cratchit's net pay is $15 $2, or $13.

The payroll listing should consist of a series of lines, one per employee, each of which contains the employee's name, gross pay, tax, and net pay. The output should be formatted in columns, as shown in the following sample run: see image.

Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.