5

Tax

  1. //           2005
  2. //
  3. //  4 334    6,83%     286,18     286.18
  4. //  8 524   19,14%   1 240,27   1 526,45
  5. // 15 004   28,26%   2 625,35   4 151,81
  6. // 24 294   37,38%   5 694,84   9 846,65
  7. // 39 529   42,62%   3 928,71  13 775,36
  8. // 48 747   48,09%
  9.  
  10. #include <iostream>
  11. #include <cstdlib>
  12.  
  13. using namespace std;
  14.  
  15. #include <assert.h>
  16.  
  17. int ir( double revenue, double shares ) {
  18.     double base, tax;
  19.     double rate;
  20.  
  21.     assert( shares > 0.0 );
  22.  
  23.     revenue *= 0.90;    // 10% off for expenses
  24.     revenue *= 0.80;    // 20% off like everybody else
  25.  
  26.     base = revenue / shares;
  27.  
  28.     cout << "Base value is: " << base << endl;
  29.  
  30.     if ( base > 48747 )
  31.         tax = 13775.36 + (base - 48747) * ((rate=48.09)/100);
  32.     else if ( base > 39529 )
  33.         tax = 9846.65 + (base - 39529) * ((rate=42.62)/100);
  34.     else if ( base > 24294 )
  35.         tax = 4151.81 + (base - 24294) * ((rate=37.38)/100);
  36.     else if ( base > 15004 )
  37.         tax = 1526.45 + (base - 15004) * ((rate=28.26)/100);
  38.     else if ( base > 8524 )
  39.         tax = 286.18 + (base - 8524) * ((rate=9.14)/100);
  40.     else if ( base > 4334 )
  41.         tax = 0 + (base - 4334) * ((rate=6.83)/100);
  42.     else
  43.         tax = rate = 0;
  44.  
  45.     cout << "Highest rate is: " << rate << "%" << endl;
  46.  
  47.     tax *= shares;
  48.  
  49.     return tax;
  50. }
  51.  
  52. int main() {
  53.     double revenue;
  54.     double shares;
  55.  
  56.     double tax;
  57.  
  58.     cout << "Enter global revenue: ";
  59.     cin >> revenue;
  60.     cout << "Number of shares? ";
  61.     cin >> shares;
  62.  
  63.     tax = ir( revenue, shares );
  64.  
  65.     cout << "Your income tax before deductions is: " << tax << endl;
  66.     cout << "Your real tax rate is " << (tax / revenue) * 100 << "%" <<  endl;
  67.  
  68.     exit( 0 );
  69. }

Comments

Your comment:
[p] [b] [i] [u] [s] [quote] [pre] [br] [code] [url] [email] strip help 2000

Enter a maximum of 2000 characters.
Improve the presentation of your text with the following formatting tags:
[p]paragraph[/p], [b]bold[/b], [i]italics[/i], [u]underline[/u], [s]strike[/s], [quote]citation[/quote], [pre]as is[/pre], [br]line break,
[url]http://www.izend.org[/url], [url=http://www.izend.org]site[/url], [email]izend@izend.org[/email], [email=izend@izend.org]izend[/email],
[code]command[/code], [code=language]source code in c, java, php, html, javascript, xml, css, sql, bash, dos, make, etc.[/code].