Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //NickG
- //Taxes Function
- #ifndef _GLIBCXX_IOSTREAM
- #include <iostream>
- using namespace std;
- #endif
- void taxes (float wage) {
- int lookup=0;
- float tax=0;
- //Lookup Table Magic Starts Here
- int lookup_table[] = {(wage<500),
- ((wage>=500)&&(wage<1000)),
- ((wage>=1000)&&(wage<2000)),
- (wage>=2000)};
- for (int done=0; done!=1; lookup++)
- if ((lookup_table[lookup]) == 1)
- done++;
- //Lookup Table Magic Ends Here
- cout << "The Federal Tax is:$";
- switch(lookup) {
- case (1):
- tax+=wage*.08;
- cout << wage*.08 <<endl;
- break;
- case (2):
- tax+=wage*.12;
- cout << wage*.12 <<endl;
- break;
- case (3):
- tax+=wage*.15;
- cout << wage*.15 <<endl;
- break;
- case (4):
- tax+=wage*.2;
- cout << wage*.2 <<endl;
- break;
- }
- tax+=wage*.025;
- cout << "The NY State Tax is:$" << wage*.025 <<endl;
- cout << "The Social Security tax is:$";
- switch(lookup) {
- case (1):
- tax+=wage*.04;
- cout << wage*.04 <<endl;
- break;
- case (2):
- tax+=wage*.06;
- cout << wage*.06 <<endl;
- break;
- case (3):
- tax+=wage*.08;
- cout << wage*.08 <<endl;
- break;
- case (4):
- tax+=wage*.1;
- cout << wage*.1 <<endl;
- break;
- }
- cout << "The weekly net pay is:$" << wage-tax <<endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement