I'm a beginner (3wks into C++)
Payroll program is due in 1hour.
I can't figure out what is wrong with my program.
it compiles, builds, and runs but when I enter the name, it goes straight to the end of the program.
heres the code
<code>
#include <conio.h>
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
float LName, FName, ID, TotalHours, PayRate, RegularHours, OvertimeHours, GrossPay, RegularPay, OvertimePay, FedTax, StTax, NetPay;
cout<<"Enter Last Name: ";
cin>>LName;
system("cls");
cout<<"Enter First Name: ";
cin>>FName;
system("cls");
cout<<"Enter ID #: ";
cin>>ID;
system("cls");
cout<<"Enter Total Hours Worked(Maximum of 60 hours): ";
cin>>TotalHours;
system("cls");
cout<<"Enter Pay Rate: ";
cin>>PayRate;
system("cls");
if( TotalHours < 40 )
{
RegularPay = TotalHours * PayRate;
}
else if( TotalHours >= 40 )
{
RegularHours = 40;
RegularPay = PayRate * 40;
OvertimeHours = TotalHours - 40;
OvertimePay = OvertimeHours * PayRate * 2;
}
if( TotalHours > 60 )
{
cout<<"You Have Entered above Maximum Hours";
}
FedTax = GrossPay * 0.20;
StTax = GrossPay * 0.05;
GrossPay = RegularPay + OvertimePay;
NetPay = GrossPay - FedTax - StTax;
cout<<"\nLast Name: "<<LName<<"First Name: "<<FName<<"ID#: "<<ID;
cout<<"\nTotal Hours: "<<TotalHours<<"Regular Hours: "<<RegularHours<<"Overtime Hours: "<<OvertimeHours<<"Pay Rate: "<<PayRate;
cout<<"\nNetpay"<<GrossPay<<" - "<<FedTax<<"-"<<StTax<<"="<<NetPay;
cout<<"\nHit any key to continue..";
getch();
return 0;
}
</code>