In this developer exercise, design and code a C++ program that utilizes a function to calculate the following for each employee from the time record input file employeehours.txt. The employeehours will have multiple records of daily time recorded. The program should loop through the records and accumulate the hours for the employee. Write a function to do the following and use reference variables to access variables from the main like name, and total hours of the employee being processed. Pay rate should be a constant. Calculate hours * the rate of $18.00 per hour for the employee. Calculate a 12% tax rate to be deducted from the total. Report employee name, total hours, gross pay, tax and net pay in one cout statement. You can choose any loop you think is appropriate for the requirements. Within the loop will process each record of the employee and tests if the new record to be processed is the same employee or a new employee. If it a new employee, call the function to calculate the required fields mentioned in previous paragraph and output the required data for the previous employee. Take special attention to end of file processing, the program may have to do a final calculation and output for the last employee. Submission requirements: Upload the emplPay.cpp program and an image of your run to Blackboard. Format of the input records is fixed and data is below. (File in Blackboard employeehours.txt).
In this developer exercise, design and code a C++ program that utilizes a function to calculate the following for each employee from the time record input file employeehours.txt. The employeehours will have multiple records of daily time recorded. The program should loop through the records and accumulate the hours for the employee. Write a function to do the following and use reference variables to access variables from the main like name, and total hours of the employee being processed. Pay rate should be a constant. Calculate hours * the rate of $18.00 per hour for the employee. Calculate a 12% tax rate to be deducted from the total. Report employee name, total hours, gross pay, tax and net pay in one cout statement. You can choose any loop you think is appropriate for the requirements. Within the loop will process each record of the employee and tests if the new record to be processed is the same employee or a new employee. If it a new employee, call the function to calculate the required fields mentioned in previous paragraph and output the required data for the previous employee. Take special attention to end of file processing, the program may have to do a final calculation and output for the last employee. Submission requirements: Upload the emplPay.cpp program and an image of your run to Blackboard. Format of the input records is fixed and data is below. (File in Blackboard employeehours.txt).
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
Related questions
Question
In this developer exercise, design and code a C++ program that utilizes a function to calculate the following for each employee from the time record input file employeehours.txt.
The employeehours will have multiple records of daily time recorded. The program should loop through the records and accumulate the hours for the employee. Write a function to do the following and use reference variables to access variables from the main like name, and total hours of the employee being processed. Pay rate should be a constant.
The employeehours will have multiple records of daily time recorded. The program should loop through the records and accumulate the hours for the employee. Write a function to do the following and use reference variables to access variables from the main like name, and total hours of the employee being processed. Pay rate should be a constant.
- Calculate hours * the rate of $18.00 per hour for the employee.
- Calculate a 12% tax rate to be deducted from the total.
- Report employee name, total hours, gross pay, tax and net pay in one cout statement.
You can choose any loop you think is appropriate for the requirements. Within the loop will process each record of the employee and tests if the new record to be processed is the same employee or a new employee. If it a new employee, call the function to calculate the required fields mentioned in previous paragraph and output the required data for the previous employee.
Take special attention to end of file processing, the program may have to do a final calculation and output for the last employee.
Submission requirements: Upload the emplPay.cpp program and an image of your run to Blackboard.
Format of the input records is fixed and data is below. (File in Blackboard employeehours.txt).
Columns
1-30 Employee name
31-32 Hours worked left justified
----+----1----+----2----+----3---
Jimmy Bucket 8
Jimmy Bucket 9
Jimmy Bucket 10
Jimmy Bucket 7
John Doe 8
John Doe 8
John Doe 8
John Doe 8
John Doe 8
Ann Doe 5
Ann Doe 5
Ann Doe 5
Ann Doe 5
Ann Doe 5
Mary Jones 4
Mary Jones 4
Mary Jones 4
Mary Jones 4
Mary Jones 4
Bob Hu 8
Bob Hu 8
Bob Hu 8
Bob Hu 8
Bob Hu 8
Sample Output:
Employee: Bob Hu Total Hours:40 Gross Pay: $720.00 Tax:$86.40 Net Pay: $633.60
The following string functions will be useful:
datarecord.substr(x,y) where x is column offset from beginning of string, and y is the number of columns.
Example: name = datarecord.substr(0,30);
Example 2: int datahours = stoi(datarecord.substr(31,2));
stod(datahours) converts string to double
Columns
1-30 Employee name
31-32 Hours worked left justified
----+----1----+----2----+----3---
Jimmy Bucket 8
Jimmy Bucket 9
Jimmy Bucket 10
Jimmy Bucket 7
John Doe 8
John Doe 8
John Doe 8
John Doe 8
John Doe 8
Ann Doe 5
Ann Doe 5
Ann Doe 5
Ann Doe 5
Ann Doe 5
Mary Jones 4
Mary Jones 4
Mary Jones 4
Mary Jones 4
Mary Jones 4
Bob Hu 8
Bob Hu 8
Bob Hu 8
Bob Hu 8
Bob Hu 8
Sample Output:
Employee: Bob Hu Total Hours:40 Gross Pay: $720.00 Tax:$86.40 Net Pay: $633.60
The following string functions will be useful:
datarecord.substr(x,y) where x is column offset from beginning of string, and y is the number of columns.
Example: name = datarecord.substr(0,30);
Example 2: int datahours = stoi(datarecord.substr(31,2));
stod(datahours) converts string to double
stoi(datahours) converts string to integer
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 2 images
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY