Programming Assignment
Employee Payroll Report


Write a program that generates an Employee Payroll Report. The input for the program consists of a collection of data containing the last name, hourly pay rate, and the number of hours worked, for a set of employees. The output of the program is a report conforming to the sample layout found in DOC:

Your program should perform the following tasks:

Repeatedly prompt the user to determine whether or not there is data pertaining to an employee to be input. (Program should work for 0 or more employees.) If the user responds in the affirmative, the program prompts for each of the input data items for a single employee; the user responds in the negative when there is no more employee data to be processed.

For each employee you are to compute the number of overtime hours worked by that employee, the salary, and the overtime pay. An employee earns straight time for the first forty hours of work, time-and-a-half for up to the first 10 hours in excess of 40 hours, and double-time for any additional hours.

One report detail line should be generated for each employee. The report should include heading lines, column headings, and "footer" line as shown in the layout document.

Data: Name Hours Hourly Rate
Clinton 35.0
15.75
Rodham 52.5
17.50
McDougal 40.0
14.00
Starr 50.0
14.00
Lewinsky 43.2
12.25


EMPLOYEE PAYROLL REPORT - SPRING 2004

---------------------------------------------------------------------------------------------------------------------------------

HOURLY OVERTIME OVERTIME TOTAL

NAME RATE HOURS HOURS SALARY SALARY

---------------------------------------------------------------------------------------------------------------------------------

XXXXXXXXXX…X 999.99 99.9 99.9 99999.99 99999.99

XXXXXXXXXX…X 999.99 99.9 99.9 99999.99 99999.99

ß ß ß ß ß ß

XXXXXXXXXX…X 999.99 99.9 99.9 99999.99 99999.99

TOTALS: 999.9 999.9 99999.9 99999.9

# OF EMPLOYEES: 999

---------------------------------------------------------------------------------------------------------------------------------

In designing your program, use functions as needed.
Make sure to document your program.


This is what I have so far and I dont know where to go from here:

#include "stdafx.h"
#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;
double salary (double hours, double rate){
return rate*hours;
}
double overtime (double hours, double rate){
return (.5*rate+rate)*(hours-40);
}
double doubletime (double hours, double rate){ 
return (rate*2)*(hours-50);
}
int main()
{
bool q= false;
char employee;
double hours;
double rate;
while (q==false){
cout<<" If you have an employee's data to be entered please push 0 and enter. If there is no employee data to be entered type 1 and enter.";
cin>> q;
cout<<" Please enter employee's last name followed by enter.";
cin>> employee;
cout<<"Please enter employee's hours, followed by enter.";
cin>> hours;
cout<<"Please enter the employee's hourly pay rate, followed by enter.";
cin>> rate;
if (hours<=40){
cout<<"salary is equal to"<<salary(hours,rate);
}
if (hours> 40 && hours<=50){
cout<<"overtime pay is equal to"<<overtime(hours,rate);
}
if (hours>50){
cout<<"double overtime pay is equal to"<<doubletime(hours,rate);
}
}
return 0;
}

Edited 6 Years Ago by peter_budo: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks)

People on here are not going to respond to your post, it is junk. Why? Well first please read the posting rules (that will pretty much tell you why) You can't just say heres my program, what do I do to finish it? You need to put in the effort, and if you get stuck on a certain part, then post your question.

Edited 6 Years Ago by hag++: n/a

Comments
agree
This article has been dead for over six months. Start a new discussion instead.