Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

c++ Skill set: Arrays of structures, using structures with functions Extend the example in the Structures notes from last week to use functions. You will

c++

Skill set: Arrays of structures, using structures with functions Extend the example in the Structures notes from last week to use functions. You will have a structure to represent Employee data: struct Employee { string eName; double hours, rate, pay; }; Create an array of structures. Make the size a const int so that the program can be easily modified. For the sample data below the size is 4. const int size = 4; Employee company[size]; Create three functions: getData receives the array of struct, and the size of the array as parameters. Prompts the user to input data which is stored in each element of the array. Validate that hours and rate are positive. Call calcPay and store the pay for each employee. calcPay receives hours and rate for a single employee. Calculates and returns the pay. Make sure to account for overtime, hours over 40 are paid at 1.5 times the rate. printPayroll receives the array of struct, and the size of the array as parameters. Prints the payroll report as shown below. Note that it also calculates and displays the total payroll. Sample Output (note formatting) Enter data for 4 employees Employee 1 name: John Doe Hours worked: 35 Hourly rate: -10 Hourly rate must be positive Please re-enter hourly rate: 10 Employee 2 name: Sue Johnson Hours worked: 50.5 Hourly rate: 15.50 Employee 3 name: Tom Jones Hours worked: 40 Hourly rate: 12.25

Employee 4 name: Elmo Jones Hours worked: 10 Hourly rate: 10 PAYROLL REPORT Employee Name Hours Rate Pay John Doe 35.00 $ 10.00 $ 350.00 Sue Johnson 50.50 $ 15.50 $ 864.13 Tom Jones 40.00 $ 12.25 $ 490.00 Elmo Jones 10.00 $ 10.00 $ 100.00 Total Payroll $1804.13 Press any key to continue

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

Step: 3

blur-text-image

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 Systems Design Implementation And Management

Authors: Peter Rob, Carlos Coronel

6th International Edition

061921323X, 978-0619213237

More Books

Students also viewed these Databases questions