#include "stdafx.h"
#using <mscorlib.dll>
using namespace System;
#include <iostream>
using namespace std;
int _tmain(){
char payType;
double payRate, salPay, sesTaxes, sesGross, totalTaxes=0, totalGross=0, aveGross, hours;
int pwPieces, empCount=1, anotherRound, hourExempt;
cout<<"Sam Lehman\nPayroll Output File\n"<<endl;
while (true){
cout<<"Pay Type? (type S, P, or H)... ";
cin>>payType;
while (true){
if (payType == 's' || payType == 'S' || payType == 'p' || payType == 'P' || payType == 'h' || payType == 'H'){
break;
}
else{
cout<<"Pay Type options can only be S, P, or H, Please try again: ";
cin>>payType;
}
}
if (payType == 'p' || payType == 'P'){
cout<<"How Much do you get paid per piece? ";
cin>>payRate;
cout<<"How Many Pieces? ";
cin>>pwPieces;
sesGross = grossPay(pwPieces, payRate);
sesTaxes = tax(sesGross);
cout<<"Employee Pieces\tPay\tPay\tGross\tTaxes"<<endl;
cout<<"Number\t Done\tRate\tPer\tPay\tPaid"<<endl;
cout<<empCount<<"\t"<<pwPieces<<"\t"<<payRate<<"\t"<<sesGross<<"\t"<<sesTaxes;
}
else if(payType == 's' || payType == 'S'){
cout<<"What is your salary per year? ";
cin>>payRate;
salPay = payRate/52;
sesGross = grossPay(salPay);
}
else if(payType == 'H' || payType == 'h'){
cout<<"How many hours did you work? ";
cin>>hours;
cout<<"How much do you get paid per hour? ";
cin>>payRate;
if (hours > 40){
cout<<" Is this employee exempt? (press 1 for yes or 0 for no)\n ";
cin>>hourExempt;
}
sesGross = grossPay(hours, payRate, hourExempt);
}
else{
cout<<"Some Type of Error Occured... Please run the program again."; return 0;
}
totalTaxes += sesTaxes;
totalGross += sesGross;
//process another?
cout<<"\n\n Would you like to calculate another employee?\n (press 1 for yes or 0 for no)\n ";
cin>>anotherRound;
if (anotherRound == 0){
aveGross = totalGross / empCount;
cout<<"\n"<<empCount<<" employees were processed for a total gross pay of "<<totalGross<<" and an average gross pay of "<<aveGross<<" with "<<totalTaxes<<" taxes collected."<<endl;
break;
}
else{
empCount++;
}
}
return 0;
}
double grossPay(int piece, double pwRate){
return piece * pwRate;
}
double grossPay(double salPay){
return salPay;
}
double grossPay(double hHours, double hRate, int exempt){
double otHours, otPay;
if (exempt == 0){
otHours = hHours - 40;
otPay = otHours * hRate * 1.5;
}
else{
otHours = hHours - 40;
otPay = otHours * hRate * 1;
}
return ((hHours - otHours)*hRate) + otPay;
}
double tax(double grossPay){
if (grossPay > 200.00 && grossPay <= 400.00){
return (grossPay * .075);
}
else if (grossPay > 400.00){
return (grossPay * .11);
}
else{
return 0;
}
}
this is what i get sofar,
here is the build log
------ Build started: Project: Program2, Configuration: Debug Win32 ------
Compiling...
Program2.cpp
Program2.cpp(32) : error C3861: 'grossPay': identifier not found, even with argument-dependent lookup
Program2.cpp(33) : error C3861: 'tax': identifier not found, even with argument-dependent lookup
Program2.cpp(44) : error C3861: 'grossPay': identifier not found, even with argument-dependent lookup
Program2.cpp(55) : error C3861: 'grossPay': identifier not found, even with argument-dependent lookup
Program2.cpp(79) : error C2365: 'grossPay' : redefinition; previous definition was a 'formerly unknown identifier'
Program2.cpp(82) : error C2365: 'grossPay' : redefinition; previous definition was a 'formerly unknown identifier'
Program2.cpp(85) : error C2365: 'grossPay' : redefinition; previous definition was a 'formerly unknown identifier'
Program2.cpp(97) : error C2365: 'tax' : redefinition; previous definition was a 'formerly unknown identifier'Build log was saved at "file://m:\Visual Studio Projects\Program2\Program2\Debug\BuildLog.htm"
Program2 - 8 error(s), 0 warning(s)
---------------------- Done ----------------------Build: 0 succeeded, 1 failed, 0 skipped
anyone know what is wrong with the function calls?
i'm pretty new to C++.