/* * [PrepNebraska.java] * * Summary: One shot program to process tax data for Nebraska. 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-14 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.revenue.state.ne.us/tax/current/salestax_forms.html download http://www.revenue.state.ne.us/question/sales.html nebraska.txt three colums, one for each rate. We use html reshape to extract columns: to get a list like this: # city rate Ainsworth, 7.0 Alliance, 7.0 Alma, 6.5 Arnold, 6.5 Atkinson, 6.5 Aurora, 6.5 We have no county info, so we treat cities like counties. */ /** * One shot program to process tax data for Nebraska. Generates code for AmericanTax.java table. * * @author Roedy Green, Canadian Mind Products * @version 1.0 2010-12-14 initial version. * @since 2010-12-10 */ public final class PrepNebraska extends PrepStateBase { /** * Constructor */ private PrepNebraska() { super( "NE", "nebraska", 5.5, false /* counties */, true /* cities */, false /* files include state rate */, false /* convert to book case */, /* guess country rates */ 150 ); } /** * 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 { final String item = c.get(); final double percent = c.getDouble() - stateTax; // we don't have any county info, so we treat cities as if they were counties. c.skipToNextLine(); if ( item.endsWith( " county" ) ) { // is a stray county salesTaxItems.add( new SalesTaxItem( ST.chopTrailingString( item, "county" ), "", percent ) ); } else { // city salesTaxItems.add( new SalesTaxItem( "", item, percent ) ); } } // default count and city processors are fine. @SuppressWarnings( { "InfiniteLoopStatement" } ) public static void main( String[] args ) throws IOException { new PrepNebraska().prepare(); } }