C++ This exercise will provide practice with working with structures and arrays. Although there might be many...

80.2K

Verified Solution

Question

Programming

C++

This exercise will provide practice with working with structuresand arrays. Although there might be many ways of doing theassignment, to get full credit, it must be done exactly asspecified here(for purpose of practice)

Write a program that will record information about employees andwill compute their paychecks. Each employee must be represented bya struct containing the last name, hours worked each day of theweek, the hourly rate, and the pay for the week.

Hours worked each day of the week must be and array storing 5values for the hours from Monday to Friday( The company is not openon Saturday or Sunday). This array will be inside thestructure.

There will also be an array of the employees; array ofstructures. There must be at least four (4) employees. The arraymust be declared in the main function of the program. Then theentire array must be passed to a function called 'initialize'. Thisfunction will ask the user to enter values for every field of everystructure, except for the pay for that week. ( the pay will becomputed in a different function)

A loop for processing the array of employees must be set up inthe main function. Inside the loop, a single employee will be pastto the function called 'compute', which will calculate the checkfor that employee. If the employee worked longer than 40 hours,overpay of 1.5 times the hourly rate is to be used for each hourworked over the 40 hours. For example, an employee who worked atotal of 50 hours for $10.00 an hour would make $550.00. Don't passthe entire array of employees into the 'compute'; the employeeswill be passed one at a time into the function, until all of theirpaychecks have been calculated, at which time the loop willterminate. The employee will need to be passed by reference.

A single employee must be passed into the result function, whichwill output the last name of the employee. Do not pass the entirearray of employees to the 'result' function. Each employee must bepassed through call by value, one at a time, until all of thepaycheck amount have been output at which time the loop in the mainfunction will terminate. Then the program will end.

Answer & Explanation Solved by verified expert
4.2 Ratings (606 Votes)
ScreenshotProgramHeader filesincludeincludeincludeusing namespace stdCreate a structure for employeestruct Employee string lastName double    See Answer
Get Answers to Unlimited Questions

Join us to gain access to millions of questions and expert answers. Enjoy exclusive benefits tailored just for you!

Membership Benefits:
  • Unlimited Question Access with detailed Answers
  • Zin AI - 3 Million Words
  • 10 Dall-E 3 Images
  • 20 Plot Generations
  • Conversation with Dialogue Memory
  • No Ads, Ever!
  • Access to Our Best AI Platform: Flex AI - Your personal assistant for all your inquiries!
Become a Member

Other questions asked by students