Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Need help with this C++ program and code: A company hired 10 temporary workers who are paid hourly and you are given a data file

Need help with this C++ program and code:

A company hired 10 temporary workers who are paid hourly and you are given a data file that contains the last name and first name of the employee, the number of hours each employee worked in a week, and the hourly pay rate of each employee. You are asked to write a program that computes each employees weekly pay and the average weekly salary of all the workers. The program then outputs the following: 1) weekly pay of each employee in ascending order according to employee last names, 2) the average weekly pay, 3) the names and weekly pay of each employee whose pay is greater than or equal to the average pay, also in ascending order of employee names.

If the number of hours worked in a week is more than 40 hours, then the pay rate for the hours over 40 is 1.5 times the regular hourly rate.

For practice purpose, you are asked to use char arrays to store the employee names instead of using strings. Use two parallel arrays: one two-dimensional array to store the names of all the employees, and one two-dimensional array of 10 rows and 3 columns to store the number of hours an employee worked in a week, the hourly pay rate, and the weekly pay.

Your program must contain at least the following functions:

A function to read the data from the file into the arrays

A function to sort the arrays based on employees name in ascending order. Use the C-library function for char arrays to compare the names and switch the row positions. Dont use the swap algorithm.

A function to determine the weekly pay.

A function to output the names of all the employees whose pay is greater than or equal to the average weekly pay.

A function to output each employees data.

Language: C++ // Visual Studio

Data.txt:

Johnson Michael 60 12.50 Aniston Thomas 65 13.25 Cooper Union 50 14.50 Gupta Mary 70 14.75 Blair Smith 55 10.50 Clark Chris 40 18.75 Kennedy John 45 20.50 Bronson Keith 60 20.00 Sunny Paul 65 18.75 Smith Patrick 30 9.75 

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

Intelligent Databases Object Oriented Deductive Hypermedia Technologies

Authors: Kamran Parsaye, Mark Chignell, Setrag Khoshafian, Harry Wong

1st Edition

0471503452, 978-0471503453

More Books

Students also viewed these Databases questions