/* * [PrepSouthDakota.java] * * Summary: One shot program to process tax data for South Dakota. 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 2010-12-17 initial version. */ package com.mindprod.americantax; import com.mindprod.common18.ST; import com.mindprod.csv.CSVReader; import java.io.IOException; /* NOT FINISHED. Can't find list of counties or method for City -> county home: http://www.state.sd.us/drr2/businesstax/st/salestax.htm view: http://www.state.sd.us/drr2/businesstax/municipaltax/municipaltaxrates_january11.htm save as southdakotacities.html Use HTMLValidator to strip all tags without "/" "*" "General Sales" "Gross Receipts" "Return to Top" "Excise Tax" "-1" "-2" - southdakotacities.html > temp.txt blout temp.txt unindent and get rid of blank lines with vs. Use vs regex to get rid of second % Prune stray - fields, blank lines etc. save as southdakotacities.txt lines2CSV southdakotacities.txt 2 gives southdakotacities.csv # city rate without state tax ABERDEEN,2 AKASKA,2 ALCESTER,2 ALEXANDRIA,2 We have no county info, just cities. */ /** * One shot program to process tax data for South Dakota. Generates code for AmericanTax.java table. * * @author Roedy Green, Canadian Mind Products * @version 1.0 2010-12-17 initial version. * @since 2010-12-17 */ public final class PrepSouthDakota extends PrepStateBase { /** * Constructor */ private PrepSouthDakota() { super( "SD", "southdakota", 4.0, false /* counties */, true /* cities */, false /* files include state rate */, true /* convert to book case */, /* guess country rates */ 300 ); } /** * 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 java.io.IOException if cannot read file */ void prepareCity( final CSVReader c ) throws IOException { final String city = ST.toBookTitleCase( c.get() ); final double percent = c.getDouble(); // we don't have any county info c.skipToNextLine(); salesTaxItems.add( new SalesTaxItem( "", city, percent ) ); } // default count and city processors are fine. @SuppressWarnings( { "InfiniteLoopStatement" } ) public static void main( String[] args ) throws IOException { new PrepSouthDakota().prepare(); } }