Here is how to indent:
Code:
#include<iostream>
#include<string>
using namespace std;
int main(){
float rate,hours,overtime,overtimerate,undues,overtimehours;
float dependents,dependnum,netpay,grosspay,sstaxt,fitaxt,sitaxt; //declares variables
string dependanswer;
overtimehours=hours-40;
overtimerate=16.78/2;
rate=16.78;
grosspay=rate*hours;
overtime=overtimehours*overtimerate;
sstaxt=grosspay*.06;
fitaxt=grosspay*.14;
sitaxt=grosspay*.05;
undues=10;
dependents=35;
cout<<"How many hours were worked? \n"; //asks how many hours worked
cin>>hours;
cout<<"Do you have any dependents? <Y or N>? \n"; //do yo have dependents
cin>>dependanswer;
if(hours>=41 && dependanswer=="y" || dependanswer=="Y" ){ //if you worked overtime and have dependents
cout<<"How many dependents do you have? \n";
cin>>dependnum;
if(dependnum>=3){ //if you have 3 or more dependents
overtimehours=hours-40;
overtimerate=16.78/2;
rate=16.78;
overtime=overtimehours*overtimerate;
sstaxt=grosspay*.06;
fitaxt=grosspay*.14;
sitaxt=grosspay*.05;
undues=10;
dependents=35;
grosspay=hours*rate+overtime;
netpay=grosspay-sstaxt-fitaxt-sitaxt-undues-dependents;
cout<<"Gross Pay: $"<<grosspay<<" \n"; //outputs what i want
cout<<"Overtime hours: "<<overtimehours<<" \n";
cout<<"Social Security: $"<<sstaxt<<" \n";
cout<<"Federal Income: $"<<fitaxt<<" \n";
cout<<"State Income: $"<<sstaxt<<" \n";
cout<<"Union Dues: $10 \n";
cout<<"Health Insurance: $"<<dependents<<" \n";
cout<<"Net Pay: $"<<netpay<<" \n";
}
if(dependnum<=2){ //if you have less than 3 dependents
overtimehours=hours-40;
overtimerate=16.78/2;
rate=16.78;
overtime=overtimehours*overtimerate;
sstaxt=grosspay*.06;
fitaxt=grosspay*.14;
sitaxt=grosspay*.05;
undues=10;
grosspay=hours*rate+overtime;
netpay=grosspay-sstaxt-fitaxt-sitaxt-undues;
cout<<"Gross Pay: $"<<grosspay<<" \n";
cout<<"Overtime hours: "<<overtimehours<<" \n";
cout<<"Social Security: $"<<sstaxt<<" \n";
cout<<"Federal Income: $"<<fitaxt<<" \n";
cout<<"State Income: $"<<sstaxt<<" \n";
cout<<"Union Dues: $10 \n";
cout<<"Health Insurance: $0 \n";
cout<<"Net Pay: $"<<netpay<<" \n";
}
}
if(hours>=41 && dependanswer=="n" ||dependanswer=="N"){ //if overtime & you dont have dependents
overtimehours=hours-40;
overtimerate=16.78/2;
rate=16.78;
overtime=overtimehours*overtimerate;
sstaxt=grosspay*.06;
fitaxt=grosspay*.14;
sitaxt=grosspay*.05;
undues=10;
grosspay=hours*rate+overtime;
netpay=grosspay-sstaxt-fitaxt-sitaxt-undues;
cout<<"Gross Pay: $"<<grosspay<<" \n";
cout<<"Overtime hours: "<<overtimehours<<" \n";
cout<<"Social Security: $"<<sstaxt<<" \n";
cout<<"Federal Income: $"<<fitaxt<<" \n";
cout<<"State Income: $"<<sstaxt<<" \n";
cout<<"Union Dues: $10 \n";
cout<<"Health Insurance: $0 \n";
cout<<"Net Pay: $"<<netpay<<" \n";
}
if(hours<=40 && dependanswer=="y" || dependanswer=="Y"){ //if no overtime and dependents
cout<<"How many dependents do you have? \n";
cin>>dependnum;
if(dependnum>=3){ //if you have 3 or more dependents
rate=16.78;
grosspay=rate*hours;
sstaxt=grosspay*.06;
fitaxt=grosspay*.14;
sitaxt=grosspay*.05;
undues=10;
dependents=35;
netpay=grosspay-sstaxt-fitaxt-sitaxt-undues-dependents;
cout<<"Gross Pay: $"<<grosspay<<" \n";
cout<<"Overtime hours: 0 \n";
cout<<"Social Security: $"<<sstaxt<<" \n";
cout<<"Federal Income: $"<<fitaxt<<" \n";
cout<<"State Income: $"<<sstaxt<<" \n";
cout<<"Union Dues: $10 \n";
cout<<"Health Insurance: $"<<dependents<<" \n";
cout<<"Net Pay: $"<<netpay<<" \n";
}
if(dependnum<=2){ //if you have less than 3 dependents
rate=16.78;
grosspay=rate*hours;
sstaxt=grosspay*.06;
fitaxt=grosspay*.14;
sitaxt=grosspay*.05;
undues=10;
netpay=grosspay-sstaxt-fitaxt-sitaxt-undues;
cout<<"Gross Pay: $"<<grosspay<<" \n";
cout<<"Overtime hours: 0 \n";
cout<<"Social Security: $"<<sstaxt<<" \n";
cout<<"Federal Income: $"<<fitaxt<<" \n";
cout<<"State Income: $"<<sstaxt<<" \n";
cout<<"Union Dues: $10 \n";
cout<<"Health Insurance: $0 \n";
cout<<"Net Pay: $"<<netpay<<" \n";
}
}
if(hours<=40 &&dependanswer=="n"||dependanswer=="N"){ //if no overtime and no dependents
rate=16.78;
grosspay=rate*hours;
sstaxt=grosspay*.06;
fitaxt=grosspay*.14;
sitaxt=grosspay*.05;
undues=10;
netpay=grosspay-sstaxt-fitaxt-sitaxt-undues;
cout<<"Gross Pay: $"<<grosspay<<" \n";
cout<<"Overtime hours: 0 \n";
cout<<"Social Security: $"<<sstaxt<<" \n";
cout<<"Federal Income: $"<<fitaxt<<" \n";
cout<<"State Income: $"<<sstaxt<<" \n";
cout<<"Union Dues: $10 \n";
cout<<"Health Insurance: $0 \n";
cout<<"Net Pay: $"<<netpay<<" \n";
}
system("pause");
return 0;
}