Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

undefined Payroll Modification: See the attached file for code to modify. Modify the code to use three linked lists instead of three arrays to hold

image text in transcribedimage text in transcribedimage text in transcribedundefined

Payroll Modification: See the attached file for code to modify. Modify the code to use three linked lists instead of three arrays to hold the employee IDs, hours worked, and wages. When the program starts, it should ask the user to enter the employee IDs. There should be no limit on the number of IDs the user can enter. 1 // Chapter 7, Programming Challenge 9: Payroll 2 #include 3 #include 4 using namespace std; 5 6 // Constant for the array size. 7 const int ARRAY_SIZE = 7; 8 9 // Function Prototypes 10 void get Employee Info(long [], int [], double [], double [], int); 11 void displayWages (long [], double [], int); 12 13 int main() 14 { 15 // Array of employee ID numbers 16 long empId[ARRAY_SIZE] = { 5658845, 4520125, 7895122, 17 8777541, 8451277, 1302850, 18 7580489 }; 19 20 // Array to hold the hours worked for each employee 21 int hours[ARRAY_SIZE); 22 23 // Array to hold the hourly pay rate for each employee 24 double payRate(ARRAY_SIZE]; 25 26 // Array to hold the gross wages for each employee 27 double wages[ARRAY_SIZE]; 28 29 // Get the employee payroll information and store 30 // it in the arrays. 31 getEmployeeInfo(empId, hours, payRate, wages, ARRAY_SIZE); 32 33 // Display the payroll information. 34 displayWages (empId, wages, ARRAY_SIZE); 35 36 return 0; 37 } 38 39 // ******** *************** 40 // The get Employee Info function receives four parallel 41 // arrays as arguments. The 1st array contains employee 42 // IDs to be displayed in prompts. It asks for input and 43 // stores hours worked and pay rate information in the * 44 // 2nd and 3rd arrays. This information is used to 45 // calculate gross pay, which it stores in the 4th array. * 46 //************************* ***************************** 47 void get Employee Info(long emp[], int hrs[], double rate[], 48 double pay[], int size) 49 { 50 cout > hrs[count); * II 11 61 62 // Validate hours worked. 63 while (hrs > hrs[count]; 68 } 69 70 // Get this employee's pay rate. 71 cout > rate[count]; 73 74 // Validate the pay rate. 75 while (rate[count] > rate(count); 80 } 81 // Calculate this employee's gross pay. 83 pay[count] = hrs[count] * rate[count]; } 85} 86 87 // ****** 88 // The displayWages function receives 2 parallel arrays. 89 // The first holds employee IDs and the second holds 90 // employee gross pay. The function displays this 91 // information for each employee. 92 // ******* 93 void displayWages (long emp[], double pay[], int size) 94 { // Set up the numeric output formatting. cout

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Fundamentals Study Guide

Authors: Dr. Sergio Pisano

1st Edition

B09K1WW84J, 979-8985115307

Students also viewed these Databases questions

Question

What is the difference between wages and salaries?

Answered: 1 week ago

Question

=+What kinds of problems need to be overcome?

Answered: 1 week ago

Question

=+Describe an important trade-off you recently faced

Answered: 1 week ago