Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This is C++ Program, and needs to be compiled with GNU++ Compiler. This program is all done just need to change little bit. Question need

This is C++ Program, and needs to be compiled with GNU++ Compiler.

This program is all done just need to change little bit.

Question need to be solved:

Program does not display or format output correctly. Need to factor in overtime pay (1.5x hourly rate for hours over 40) when calculating the gross amount. Should close file at the end of the program. Code is hard to follow, indentation should be used.

Orignal Question:

image text in transcribedimage text in transcribed

Payroll2.cpp

#include #include #include #include //to use setw() function #include //to use atof(function) using namespace std; void reportTitle() { cout

Write a program in a file named Payroll2.cpp that reads and processes each line of input in the sequential input file payroll.txt. The lines of the file contain a string with an embedded blank that should be interpreted as an employee name. After the name, the input line contains a single pound (#) character followed by 3 double values. These should be interpreted as an employee's hourly salary, the number of hours that the employee has worked and the tax rate as a percentage that is used for that employee. After inputing the remaining data on the input line, your program should display formatted values of the input values followed by the employee's gross salary (hours x hourly, with time and one-half for the number of hours beyond 40) and the net salary (the gross salary minus the gross salary x the tax rate/100). Upon reaching the end of the file, your program should display the total of all of the gross salaries and the total of all of the net salaries. All monetary amounts should be right justified and formatted to display 2 digits to the right of the decimal point. All output for this program should be displayed on the monitor and should be embedded withir functions. The file Payrolll.cpp contains functions instructions) and reportTitle() that display a descriptive message and the column headings, respectively. In addition, the program in Payroll2.cpp should use functions displayEmployeeInfo() to display the salary information for each employee and the function totalAmounts() to display the total_gross and total net. Variables (no global variables allowed): name, hourly, hours, rate Employee name (contains embedded blanks), hourly rate, hours worked and tax rate net, gross net and gross income for employee total_net, total gross total net and total gross income (accumulation variables) Input: payroll.txt Read employee name, hourly rate, hours worked and tax rate from the input file payroll.txt

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

Automating Access Databases With Macros

Authors: Fish Davis

1st Edition

1797816349, 978-1797816340

More Books

Students also viewed these Databases questions

Question

1 . Television News channels importantance of our Life pattern ?

Answered: 1 week ago

Question

What is the most important part of any HCM Project Map and why?

Answered: 1 week ago