Hi to all.
Could you guys help me with a little program. There is something wrong with tahat and can't find that. That's the code:

``````/* An employee is paid at rate of 16.78\$ per hour for the first 40 hours worked in a week. Any hours over that are paid at the overtime
rate of one and one half times that. From the worker's gross pay, 6% is witheld for social security tax, 14% is witheld for federal
income tax, 5% is witheld for state income tax, and 10 dollars per week is witheld for union dues. If the worker has three or more
dependents, then the additional 35 dollars is withheld to cover the extra cost of helf insurance beyond what the employer pays. Write
the program that will read in the number of hours worked in a week and the number of dependents as input, and will then output the
worker's gross pay , each witholding amount , and the net take home pay for the week. For the harder version , write your program so
that it allows the calculation to be repeated as often as the user wishes.
*/
#include <iostream>
using namespace std;
int main()
{
const double rate=16.78;
const double social_tax= 0.06;
const double federal_tax=0.14;
const double state_tax=0.05;
const int three_dependents=35;

int hours,dependents;
double net_pay,x,gross_pay,overtime,state_tax_pay,pay_overtime,social_tax_pay,federal_tax_pay;
cout<<" What's your hours this week: ";
cin>>hours;
cout<<"How many children you have?: ";
cin>>dependents;
if (hours>40)
{
if (dependents>=3)
{
overtime=hours-40;
pay_overtime=overtime*(rate*1.5);
gross_pay= rate*hours+pay_overtime;
social_tax_pay=gross_pay*social_tax;
cout<<"Your sosial tax pay is equal to: "<<social_tax_pay<<endl;
federal_tax_pay=gross_pay*federal_tax;
cout<<"Your federal tax pay is equal to: "<<federal_tax_pay<<endl;
state_tax_pay=gross_pay*state_tax;
cout<<"Your state tax pay is equal to: "<<state_tax_pay<<endl;
cout<<"You have to pay additional 35\$ becouse you heve more then two dependends\n";
net_pay=gross_pay-social_tax_pay-federal_tax_pay-state_tax_pay-35;
cout<<"Your net pay is equeall to: <<net_pay;
}
else
{
overtime=hours-40;
pay_overtime=(rate*1.5)*overtime;
gross_pay= (rate*hours)+pay_overtime;
social_tax_pay=gross_pay*social_tax;
cout<<"Your sosial tax pay is equal to: "<<social_tax_pay<<endl;
federal_tax_pay=gross_pay*federal_tax;
cout<<"Your federal tax pay is equal to: "<<federal_tax_pay<<endl;
state_tax_pay=gross_pay*state_tax;
cout<<"Your state tax pay is equal to: "<<state_tax_pay<<endl;
net_pay=gross_pay-social_tax_pay-federal_tax_pay-state_tax_pay;
cout<<"Your net pay is equeall to: <<net_pay;
}
}
else
{
if (dependents>=3)
{
gross_pay= rate*hours;
social_tax_pay=gross_pay*social_tax;
cout<<"Your sosial tax pay is equal to: "<<social_tax_pay<<endl;
federal_tax_pay=gross_pay*federal_tax;
cout<<"Your federal tax pay is equal to: "<<federal_tax_pay<<endl;
state_tax_pay=gross_pay*state_tax;
cout<<"Your state tax pay is equal to: "<<state_tax_pay<<endl;
cout<<"You have to pay additional 35\$ becouse you heve more then two dependends\n";
net_pay=gross_pay-social_tax_pay-federal_tax_pay-state_tax_pay-35;
cout<<"Your net pay is equeall to: <<net_pay;
}
else
{
gross_pay= rate*hours;
social_tax_pay=gross_pay*social_tax;
cout<<"Your sosial tax pay is equal to: "<<social_tax_pay<<endl;
federal_tax_pay=gross_pay*federal_tax;
cout<<"Your federal tax pay is equal to: "<<federal_tax_pay<<endl;
state_tax_pay=gross_pay*state_tax;
cout<<"Your state tax pay is equal to: "<<state_tax_pay<<endl;
net_pay=gross_pay-social_tax_pay-federal_tax_pay-state_tax_pay;
cout<<"Your net pay is equeall to: <<net_pay;
}
}
}``````

never mind i got that

helo, mauro21pl would you mind if you share it to me, i mean the right code of that program you posted...pls..

No quotation marks on

``cout<<"Your net pay is equeall to: <<net_pay;``

Wrong spelling. No display.

check this out

``````#include <iostream>
#include<conio.h>
using namespace std;

int main(){

const double rate=16.78;
const double social_tax= 0.06;
const double federal_tax=0.14;
const double state_tax=0.05;
const int three_dependents=35;
int hours,dependents;
double net_pay,x,gross_pay,overtime,state_tax_pay,pay_overtime,social_tax_pay,federal_tax_pay;
cout<<" What's your hours this week: ";
cin>>hours;
cout<<"How many children you have?: ";
cin>>dependents;
if (hours>=40){
if (dependents>=3)
{
overtime=hours-40;

pay_overtime=overtime*(rate*1.5);

gross_pay= rate*hours+pay_overtime;

social_tax_pay=gross_pay*social_tax;

cout<<"Your social tax pay is equal to: "<<social_tax_pay<<endl;

federal_tax_pay=gross_pay*federal_tax;

cout<<"Your federal tax pay is equal to: "<<federal_tax_pay<<endl;

state_tax_pay=gross_pay*state_tax;

cout<<"Your state tax pay is equal to: "<<state_tax_pay<<endl;

cout<<"You have to pay additional 35\$ becouse you heve more then two dependends\n";

net_pay=gross_pay-social_tax_pay-federal_tax_pay-state_tax_pay-35;

cout<<"Your net pay is equal to: "<<net_pay;

}
else if(hours<40){
overtime=hours-40;

pay_overtime=(rate*1.5)*overtime;

gross_pay= (rate*hours)+pay_overtime;

social_tax_pay=gross_pay*social_tax;

cout<<"Your social tax pay is equal to: "<<social_tax_pay<<endl;

federal_tax_pay=gross_pay*federal_tax;

cout<<"Your federal tax pay is equal to: "<<federal_tax_pay<<endl;

state_tax_pay=gross_pay*state_tax;

cout<<"Your state tax pay is equal to: "<<state_tax_pay<<endl;

net_pay=gross_pay-social_tax_pay-federal_tax_pay-state_tax_pay;

cout<<"Your net pay is equall to: "<<net_pay;
}

}

else if (dependents>=3)

{

gross_pay= rate*hours;

social_tax_pay=gross_pay*social_tax;

cout<<"Your social tax pay is equal to: "<<social_tax_pay<<endl;

federal_tax_pay=gross_pay*federal_tax;

cout<<"Your federal tax pay is equal to: "<<federal_tax_pay<<endl;

state_tax_pay=gross_pay*state_tax;

cout<<"Your state tax pay is equal to: "<<state_tax_pay<<endl;

cout<<"You have to pay additional 35\$ because you heve more then two dependends\n";

net_pay=gross_pay-social_tax_pay-federal_tax_pay-state_tax_pay-35;

cout<<"Your net pay is equal to: "<<net_pay;

}

else if(dependents<3){
gross_pay= rate*hours;
cout<<"Gross pay is: "<<gross_pay<<endl;
social_tax_pay=gross_pay*social_tax;
cout<<"Your social tax pay is equal to: "<<social_tax_pay<<endl;
federal_tax_pay=gross_pay*federal_tax;
cout<<"Your federal tax pay is equal to: "<<federal_tax_pay<<endl;
state_tax_pay=gross_pay*state_tax;
cout<<"Your state tax pay is equal to: "<<state_tax_pay<<endl;
net_pay=gross_pay-social_tax_pay-federal_tax_pay-state_tax_pay;
cout<<"Your net pay is equal to: "<<net_pay;

}

getch();
return(0);
}``````
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.