Sha256: 60e53dff95ca77c866a389982992997aadbfb18ebdbae8aaa0f7f75ea83c3bf6

Contents?: true

Size: 1022 Bytes

Versions: 3

Compression:

Stored size: 1022 Bytes

Contents

# frozen_string_literal: true

require "tax_calculator/version"
require "tax_calculator/federal"
require "tax_calculator/fica"
require "tax_calculator/deductions"
require "tax_calculator/ohio"
require "tax_calculator/ohio/columbus"

module TaxCalculator
  class TaxCalculator
    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

    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
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
tax_calculator-0.4.0 lib/tax_calculator.rb
tax_calculator-0.3.0 lib/tax_calculator.rb
tax_calculator-0.2.0 lib/tax_calculator.rb