Sales taxes in the United States are complicated, to say the least. Generally, there's a state sales tax (there are a handful of states that do not collect a state sales tax), but there could also be a county sales tax, a school district sales tax, a municipal (city) sales tax, or a metropolitan area sales tax. There could even be different sales taxes in different parts of a city. For the purposes of this challenge, however, we're going to focus on just the state sales tax.
Given a U.S. dollar amount greater than zero (accurate to two decimal places) and a state (either the full name or the two-letter abbreviation, your choice, case doesn't matter), and using the below chart of sales tax percentages, output the corresponding state sales tax required to be collected for that particular sale, accurate and truncated to two decimal places. Please specify how your code handles rounding.
Edit: The abbreviation for Washington was listed incorrectly as WS instead of WA. Answers may use either abbreviation, since that was my goof.
State Abbr %
Alabama AL 4.00%
Alaska AK 0.00%
Arizona AZ 5.60%
Arkansas AR 6.50%
California CA 6.00%
Colorado CO 2.90%
Connecticut CT 6.35%
Delaware DE 0.00%
Florida FL 6.00%
Georgia GA 4.00%
Hawaii HI 4.00%
Idaho ID 6.00%
Illinois IL 6.25%
Indiana IN 7.00%
Iowa IA 6.00%
Kansas KS 6.50%
Kentucky KY 6.00%
Louisiana LA 5.00%
Maine ME 5.50%
Maryland MD 6.00%
Massachusetts MA 6.25%
Michigan MI 6.00%
Minnesota MN 6.875%
Mississippi MS 7.00%
Missouri MO 4.23%
Montana MT 0.00%
Nebraska NE 5.50%
Nevada NV 4.60%
New Hampshire NH 0.00%
New Jersey NJ 6.88%
New Mexico NM 5.13%
New York NY 4.00%
North Carolina NC 4.75%
North Dakota ND 5.00%
Ohio OH 5.75%
Oklahoma OK 4.50%
Oregon OR 0.00%
Pennsylvania PA 6.00%
Rhode Island RI 7.00%
South Carolina SC 6.00%
South Dakota SD 4.50%
Tennessee TN 7.00%
Texas TX 6.25%
Utah UT 4.70%
Vermont VT 6.00%
Virginia VA 4.30%
Washington WA 6.50%
West Virginia WV 6.00%
Wisconsin WI 5.00%
Wyoming WY 4.00%
Example for California at 6% state sales tax --
CA
1025.00
61.50
Example for Minnesota at 6.875% --
MN
123.45
8.49
Minnesota MN 6.875%
- because .005% is, well, actually a lot. \$\endgroup\$