The bookkeeper has started to get really excited about what the computer can do for the business and for its financial information. He thinks that it might be useful if your payroll program could build a big in-memory table of all of the paychecks written each week. That way, another program could help determine the highest-paid employee or the one who's not had a pay raise in a long time.

You can anticipate that you'll want to write this data out to a file later on, but in order to process it, to make it so it can search or look for specific paychecks, for example, youll need to be able to read it all into memory and hold it in a big table.

As this will be the last activity related to the Programming Corner, be sure to update the documentation in your RAPTOR program, to show when you've modified it and what youve done to it.

The bookkeeper has started to get really excited about what the computer can do for the business, and for its financial information. So what he'd like you to do is to add a way to remember all of the payroll data, and then be able (next week!) to be able to sort it, search it, and perform other to-be-specified (invented?) operations on it.

So to help bound this problem, you ask for some simplifying assumptions. We'll start small, you insist. One pay periods data at a time. And we need an upper bound or a limit on how many paychecks per period we might write. Suppose we set that at 25, since right now we only have nine employees in the company. Plenty of room for growth without having to change the DIMENSION statements in the program... but, to be on the safe side, you might declare a variable with a name like max_payevents_perperiod as a way to keep all of your loop limit checking using the same limit value!

What we'd like to do this week is to modify the program so that after it prompts for the company-wide tax rate data, it prompts for and inputs a maximum of max_payevents_perperiod sets of per-employee / per-paycheck data, validates that data, calculates each check, prints each check, and then keeps all of that data in a set of parallel arrays, each of one dimension. These might be:

  • empname (string, of a certain max length)
  • emp_id (number)
  • hours_worked (number)
  • pay_rate (number)
  • et cetera. Make sure that all of the per-paycheck data you were using in previous editions of this program get represented in their own arrays, including the results of doing the payroll calculations!

You'll probably notice that you can accomplish this by:

  • Designing an appropriate outer loop
  • Replacing references to simple variable names (like empl_id) with references to subscripted positions in the corresponding parallel array, using the loop counter as the index expression (ie, empl_id(k), if k is the loop counter)
  • Realizing that some arrays will have data put in them when it's been input and validated, and others when you perform the payroll calculation.

Be sure to update the documentation in your RAPTOR program, to show when you've modified it and what youve done to it.

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.