/* * [PrepWashington.java] * * Summary: One shot program to process tax data for Washington. Generates code for AmericanTax.java table. * * Copyright: (c) 1999-2017 Roedy Green, Canadian Mind Products, http://mindprod.com * * Licence: This software may be copied and used freely for any purpose but military. * http://mindprod.com/contact/nonmil.html * * Requires: JDK 1.8+ * * Created with: JetBrains IntelliJ IDEA IDE http://www.jetbrains.com/idea/ * * Version History: * 1.0 2008-05-22 * 1.1 2010-12-10 update to produce CSV file without state tax included. */ package com.mindprod.americantax; import com.mindprod.csv.CSVReader; import java.io.IOException; /** * One shot program to process tax data for Washington. Generates code for AmericanTax.java table. * * @author Roedy Green, Canadian Mind Products * @version 1.1 2010-12-10 update to produce CSV file without state tax included. * @since 2008-05-22 */ public final class PrepWashington extends PrepStateBase { /** * Constructor */ private PrepWashington() { super( "WA", "washington", 5.5, false /* counties */, true /* cities */, false /* files include state rate */, false /* convert to book case */, 2000 ); } /** * Default method to read and prepare one county record. * You must read, and add SalesTaxItem to salesTaxItems, and skipToNewLine * * @param c open CSV reader. * * @throws IOException if cannot read file */ void prepareCity( final CSVReader c ) throws IOException { String city = c.get(); final String county = c.get(); final double percent = c.getDouble() * 100; c.skipToNextLine(); int place = city.indexOf( "Unincorp." ); if ( place > 0 ) { // strip of county name to the left. city = city.substring( place ); } salesTaxItems.add( new SalesTaxItem( county, city, percent ) ); } /* * Generates code for AmericanTax.java table. * home: http://dor.wa.gov/content/findtaxesandrates/SalesAndUseTaxRates/LocalSales_Use.aspx#TaxRateInfo * download "http://dor.wa.gov/Docs/forms/ExcsTx/LocSalUseTx/ExcelLocalSlsUserates_11_Q1.xls" washington.xls * This is an Excel file. Convert to CSV. Strip columns not needed. Remove in xxxx text. * # "Location County Local Rate, * Adams County Unincorp. Areas, Adams, 0.012, * Hatton, Adams, 0.012, * Lind, Adams, 0.012, * and save as E:\com\mindprod\americantax\washingtoncities.csv */ public static void main( String[] args ) throws IOException { new PrepWashington().prepare(); } }