class TaxCalculator::TaxCalculator

Public Class Methods

new(income, four_01_k, ira, hsa, health_premiums) click to toggle source
# File lib/tax_calculator.rb, line 12
def initialize(income, four_01_k, ira, hsa, health_premiums)
  @income = income.to_i
  @four_01_k = four_01_k.to_i
  @ira = ira.to_i
  @hsa = hsa.to_i
  @health_premiums = health_premiums.to_i
end

Public Instance Methods

calculate() click to toggle source
# File lib/tax_calculator.rb, line 20
def calculate
  deductions = Deductions.new(@income, @four_01_k, @ira, @hsa, @health_premiums)

  federal = Federal.taxes_for(deductions.federal).round(2)
  fica = FICA.taxes_for(deductions.fica).round(2)
  state = Ohio.taxes_for(deductions.ohio).round(2)
  county = Ohio::Columbus.taxes_for(deductions.columbus).round(2)
  total = (federal + fica + state + county).round(2)

  { :federal => federal, :fica => fica, :state => state, :county => county, :total => total }
end