Get your taxes done using TurboTax

I'm not sure what I'm misunderstanding.  The taxable income is $22300.  This is made up of $12300 ordinary ($40000 - $17700) and $10000 LT Cap Gains.  You enter the ordinary tax table with $12300 which is all within the 10% bracket i.e. $1230 tax.  The LT Cap Gains doesn't come into play because the taxable income of $22300 is within the 0% LT tax bracket.