The Payroll Challenge was all about an introduction to arrays. There are definitely many ways of approaching this program, but one of the things that I focused on in this challenge was in making the code appear as clean as possible. Not sure I achieved that, but it did give me a better understanding through practice in writing and using void functions.
Write a program which uses the following arrays:
- empID: An array of 7 integers to hold employee identification numbers. The array should be initialized with the following values: 1, 2, 3, 4, 5, 6, 7.
- Hours: an array of seven integers to hold the number of hours worked by each employee.
- payRate: an array of seven doubles to hold each employee’s hourly pay rate.
- Wages: an array of seven doubles to hold each employee’s gross salary.
- The program should display each employee number and ask the user to enter that employee’s hours and pay rate. It should then calculate the gross wages for that employee (hours times pay rate) and store them in the wages array. After the data has been entered for all the employees, the program should display each employee’s identification number and gross wages.