sub _build_net_income { my $self = shift; my $gross = $self->gross_income; my $income_tax = do { if ($gross < 6_475) { 0 } elsif ($gross < 43_875) { (0.2 * ($gross - 6_475)) } elsif ($gross < 150_000) { (0.2 * (43_875 - 6_475)) + (0.4 * ($gross - 43_875)) } else { (0.2 * (43_875 - 6_475)) + (0.4 * (150_000 - 43_875)) + (0.5 * ($gross - 150_000)) } }; my $child_tax_credit = 545 * scalar @{$self->children}; my $taxes = $income_tax - $child_tax_credit; $taxes = 0 if $taxes < 0; return $gross - $taxes; }