Ok.. So i manage to read and print the data.. But what I dont understand is how to attach it to id,rate,pay,hours.. can someone help me please im really stuck... THX
#include <iostream>
#include <iomanip>
#include <fstream>
using namespace std;
int main()
{
int hours,rate,age;
int x;
int str;
string shift;
ifstream infile;
infile.open("empfile.txt");
if (!infile)
{
cout << "unable to open file";
}
while (getline(infile, shift))
cout << shift << endl;
Read in groups of data bout employees of a company. Each group of data will contain an employees id numer, hours worked, rate of pay, and age ( the age will b an interger). A typical group data will be
643456 46.9 3.26 51
This means that employee 643456 worked 46.9 hours at 3.26 per hr nd he is 51 years old.
Print the original data as it is read in together with appropriate messages.
For each employee compute the employees base pay, which includes overtime ( paid at one and a half times the normal rate) for each hour over 40. For example, if an employee earning 20.00 per hr works for 48 hrs. then she will be paid for 40 hrs at her normal rate plus 8 extra hrs at 30.00. Print the base pay for the employee.
Then compute the tax paid by the employee, according to this formula: if the employee is 55 years old or older, then the employees pays tax at a rate of 20% of the base pay: if the employee is below 55 then the tax is 10% of the base pay. print the tax and the net pay after taxes.
after you print all of the info for an employee read the data for the next employee you must decide how to detect the end of the set of employees you should explain you choice in a comment.
after processing the last employee print a message saying that the payroll program is complete.
Heres is the data you should use when you sure the program is working correctly.
In addition to the above
1. print the employee number and age of the oldest employee.
2. print the employee number and taxes of the employee who paid the most in taxes. these names should be printed after the entire set of employees has been processed.