Question
I am not sure about how to get the text data put in to get the information output of this code EMPLOYEE INFORMATION FOR TEXT
I am not sure about how to get the text data put in to get the information output of this code
EMPLOYEE INFORMATION FOR TEXT DATA
EMPLOYEE ID-481756
NAME-BONITA KOWALSKI
MARITALSTATUS-SINGLE
HOURS WORKED-43
HOURLYRATE-12
EMPLOYEE ID-481755
NAME-WALT KOWALSKI
MARITALSTATUS-MARRIED
HOURS WORKED-12
HOURLYRATE-10
EMPLOYEE ID-481754
NAME-CHARLES XAVIER
MARITALSTATUS-SINGLE
HOURS WORKED-41
HOURLYRATE-15
EMPLOYEEID-481753
NAME-LOGAN WOLF
MARITALSTATUS-Married
HOURS WORKED-10
HOURLYRATE-9
EMPLOYEEID-481752
NAME-STORM RAIN
MARITAL STATUS-Single
HOURSWORKED-27
HOURLYRATE-10
HERE IS THE CODE I AM USING WHERE THE INFO NEEDS TO BE PUT IN
#include
#include
#include
using namespace std;
class payroll{
ifstream fin;
char employeeid[12];
char employeename[20];
char maritalstatus;
int hoursworked, overtime;
double hourlyrate, overtimepay, regularpay, grosspay, taxrate, taxamount,netpay;
void calculategrosspay();
void calculatetax();
void calculatenetpay();
void printheadings();
void printdata();
public:payroll();
~payroll();
void printreport(); };
payroll::payroll(){
fin.open("payroll,dat"); }//CONSTRUCTOR
payroll::~payroll(){
fin.close(); }//DESTRUCTOR
void payroll::calculategrosspay(){
if(hoursworked>40){
overtime=hoursworked=40;
regularpay=hoursworked*hourlyrate;
overtimepay=overtime*(hourlyrate*1.5);
grosspay=regularpay+overtimepay;}//F
else grosspay=hoursworked*hourlyrate; }//CALCULATEGROSSPAY
void payroll::calculatetax(){
if(grosspay>=500)taxrate=.30;
else if(grosspay>200)taxrate=.20;
else taxrate=.10;
if(maritalstatus='S')
taxrate=taxrate+.05;
taxamount=grosspay*taxrate; }//CALCULATETAX
void payroll::calculatenetpay(){
netpay=grosspay-taxamount; }//CALCULATENETPAY
void payroll::printheadings(){
cout< cout<<"__________________________________"< cout<<"NAME EMPLOYEEID HOURSWORKED OVERTIME REGULARPAY OVERTIMEPAY GROSS TAX NETPAY"< cout<<"__________________________________"< }//PRINTHEADINGS void payroll::printdata(){ cout< cout< void payroll::printreport(){ int i=0; printheadings(); while(fin>>employeename>>employeeid>>maritalstatus>>hoursworked>>hourlyrate){ calculategrosspay(); calculatetax(); calculatenetpay(); printdata(); i++;}//WHILE }//PRINTREPORT int main(){ payroll employee; employee.printreport() ;//MAIN return 0; } "payroll.dat" is what i am assuming would be what the employee data would be provided not sure how to go about this payroll.dat is what the example code for the assignment shows so i need to my own data text or what is being called the CONSTRUCTOR
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started