I have the following in a withholding tax calculation page:
The 2nd subscript indicates what field is used and is always constant. How can I change this into a one dimension table of objects with three fields/properties? TIACode:var EXEMPT = 3800; // May change in later years, see Publication 15, Circular E, Employer's Tax Guide from the IRS var STable = [ // Define Single Table [ 0, 0, 0], // Range, base, percentage [ 2150, 0, .10], [ 10850, 870.00, .15], // With >= 10850 & < 37500, tax is $870.00 + 15% of the amount over $10850 [ 37500, 4867.50, .25], [ 87800, 17442.50, .28], [180800, 43482.50, .33], [390500, 112683.50, .35] // Note: no comma at end ]; ...................................... for (var exmp=0; exmp < 8; exmp++) { var WkAmt = AnnAmt - EXEMPT * exmp; for (i=0; (i < (STable.length - 1)) && (WkAmt > STable[i+1][0]) ; i++) ; //Search Singles table for proper bracket. var AnnTax = STable[i][1] + (WkAmt - STable[i][0]) * STable[i][2]; document.tax2012.elements[TableSub++].value = Nformat(AnnTax / NoPeriods); }
BTW, this is the website: tax12.html.


Reply With Quote

Bookmarks