Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /***********************************************************************************/
- /* Lab.Assignment#3 */
- /* process the weekly payroll in a company of one or more employees */
- /* */
- /* Programmer: John Smith */
- /* Class CS 2400-01 */
- /* Due Date: October 12, 2017 */
- /***********************************************************************************/
- #include <iostream>
- #include <cstdlib>
- using namespace std;
- #include "EmployeeInfo.h"
- #define DUMMYNUMBER -99
- int main()
- {
- int hours = 0; //Holds the hours the people workded
- int hoursPlus= 0; //Holds the hours combined
- double netPay; //holds the netpay
- double tax; //holds the tax
- double grossPay = 0; //holds the grosspay
- double totalGrossPay = 0; //holds the total gross pay
- double totalTax = 0; // holds the total tax
- int count = 0; // holds the count for the while loop
- EmployeeInfo Employee; //Employee being computed
- while(Employee.ID != DUMMYNUMBER){
- cin >> Employee.ID >> Employee.firstName >> Employee.lastName >> Employee.birthDate.day >> Employee.birthDate.month >> Employee.birthDate.year
- >> Employee.hiredDate.day >> Employee.hiredDate.month >> Employee.hiredDate.year >> Employee.payRate;
- while(count <5){
- cin>> hours;
- hoursPlus+=hours;
- count++;
- }
- grossPay = Employee.payRate * hoursPlus;
- if(grossPay >= 1000)
- {
- tax = grossPay * .20;
- }
- else if(grossPay >= 800)
- {
- tax = grossPay * .18;
- }
- else if(grossPay >= 600)
- {
- tax = grossPay * .15;
- }
- else
- {
- tax = grossPay * .10;
- }
- netPay = grossPay - tax; //gets the net pay
- totalTax += tax; // gets the total tax
- totalGrossPay += grossPay; //gets the total grosspay
- cout << endl << Employee.lastName<<","<< Employee.firstName;
- cout << endl <<"ID:\t"<< Employee.ID;
- cout << endl << "DOB:\t"<<Employee.birthDate.day <<"/"<< Employee.birthDate.month<<"/"<< Employee.birthDate.year;
- cout << endl << "BOH:\t"<<Employee.hiredDate.day <<"/"<<Employee.hiredDate.month<<"/"<<Employee.hiredDate.year;
- cout << endl << "Hours:\t" << hoursPlus;
- cout << endl << "Pay Rate:\t$"<<Employee.payRate;
- cout << endl << "Gross Pay:\t$"<< grossPay;
- cout << endl << "Tax:\t$"<< tax;
- cout << endl << "Net Pay:\t$"<< netPay;
- cout << endl << " ";
- cout << endl << " ";
- hoursPlus = 0;
- count = 0;
- cin >> Employee.ID;
- }
- cout << endl << "the total tax deduction of the company is \t$"<< totalTax;
- cout << endl << "the total gross pay of the company is \t$"<< totalGrossPay;
- return EXIT_SUCCESS;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement