Listing tax names is a good start, but is not a convenient way to discover the appropriate taxes to apply. The TaxControls components provide a way to look up taxes using the workplace and residence ZIP codes, which will significantly reduce the number of taxes to consider.
- Enter Code
Enter the following code in a file named ‘Zips.cs’:
using System;using TaxControls;class Test{ public static void Main(){ try { CTaxControl tc = new CTaxControl(); int work=20500; int home=20301; String taxes=tc.TaxNamesForZip(work, home); foreach(String t in taxes.Split(",")){ Console.WriteLine(t); } } catch (TaxControlException e) { Console.WriteLine(e.Message); } }}
Enter the following code in a file named ‘Zips.java’:
import com.boondocks.taxcontrols.TaxControl;import com.boondocks.taxcontrols.TaxControlException;public class Zips{ public static void main(String[] args){ TaxControl tc = new TaxControl(); try{ int work=20500; int home=20301; String taxes=tc.getTaxNamesForZip(work, home); for (String t: taxes.split(",")){ System.out.println(t); } } catch (TaxControlException e){ e.printStackTrace(); } }}
- Compile
Compile the code at the command prompt by executing the following:
\...\csc.exe /reference:TaxControls.dll Zips.cs
javac -classpath .;bigloo_u.zip;TaxControls.jar Zips.java
- Run
Run the code by typing:
Zips
java -classpath .;bigloo_u.zip;TaxControls.jar Zips