Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main(){
- double income, tax;
- int status;
- cout<<"Enter your income : "<<endl;
- cin>>income;
- if (income < 0){
- cout<<"invalid income"<<endl;
- }
- else{
- cout<<"Invalid status"<<endl;
- main();
- }
- cout<<"Enter your filling status 0 is for single and 1 is for married jointly : "<<endl;
- cin>>status;
- if (status == 0){
- if (income <= 6000)
- tax = income * 0.10;
- else if (income <= 28000)
- tax = 6000 * 0.10 + (income - 6000) * 0.15;
- else if (income <= 67700)
- tax = 6000 * 0.10 + (28000 - 6000) * 0.15 + (income - 28000) * 0.27;
- else if (income <= 141250)
- tax = 6000 * 0.10 + (27950 - 6000) * 0.15 + (67700 - 27950) * 0.27 + (income - 67700) * 0.30;
- else if (income <= 307050)
- tax = 6000 * 0.10 + (27950 - 6000) * 0.15 + (67700 - 27950) * 0.27 + (141250 - 67700) * 0.30 + (income - 141250) * 0.35;
- else
- tax = 6000 * 0.10 + (28000 - 6000) * 0.15 + (67700 - 27950) * 0.15 + (67700 - 27950) * 0.27 + (141250 - 67700) * 0.30 + (307050 - 141250) * 0.35 + (income - 307050) * 0.386;
- }
- else if (status == 1){
- if (income <= 6000)
- tax = (income * 0.10)*0.83;
- else if (income <= 28000)
- tax = (6000 * 0.10 + (income - 6000) * 0.15) * 0.83;
- else if (income <= 67700)
- tax = (6000 * 0.10 + (28000 - 6000) * 0.15 + (income - 67700) * 0.27) * 0.83;
- else if (income <= 141250)
- tax = (6000 * 0.10 + (27950 - 6000) * 0.15 + (67700 - 27950) * 0.27 + (income - 67700) * 0.30) * 0.83;
- else if (income <= 307050)
- tax = (6000 * 0.10 + (27950 - 6000) * 0.15 + (67700 - 27950) * 0.27 + (141250 - 67700) * 0.30 + (income - 141250) * 0.35) * 0.83;
- else
- tax = (6000 * 0.10 + (28000 - 6000) * 0.15 + (67700 - 27950) * 0.15 + (67700 - 27950) * 0.27 + (141250 - 67700) * 0.30 + (307050 - 141250) * 0.30 + (income - 307050) * 0.386) * 0.83;
- }
- cout<<"Tax is"<<static_cast<int>(tax * 100) / 100<<endl;
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment