smeacham

Structured Programming Example - Blocks

Aug 30th, 2012
202
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.60 KB | None | 0 0
  1. int taxes(int wages, int tax_threshold, int supertax_threshold, float tax_rate, float supertax_rate) {
  2.   int paystax, pays_supertax;
  3.   int tax, int supertax;
  4.  
  5.   if (wages > tax_threshold) {
  6.     paystax = true;
  7.     tax = (wages - tax_threshold) * tax_rate;
  8.  
  9.     if (wages > supertax_threshold) {
  10.       pays_supertax := true;
  11.       supertax = (wages - supertax_threshold) * supertax_rate;
  12.     }
  13.     else {
  14.       pays_supertax = false;
  15.       supertax = 0;
  16.     }
  17.   }
  18.   else {
  19.     paystax = false;
  20.     pays_supertax = false;
  21.     tax = 0;
  22.     supertax = 0;
  23.   }
  24.  
  25.   return wages - tax - supertax;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment