Interval Membership
A Programming Pattern |
Prof. David Bernstein
|
Computer Science Department |
bernstdh@jmu.edu |
left
and
right
) that contain the left and right
boundariesint
values, of
String
values)The following fragment uses interval membership to determine the tax bracket for a single individual in 2017.
javaexamples/programmingpatterns/intervalmembership/IntervalMembership.java (Fragment: taxBracket)This can be combined with a look-up array to get the marginal tax rate.
javaexamples/programmingpatterns/intervalmembership/IntervalMembership.java (Fragment: taxRate)