Skip to content

ZIP lookup

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.

  1. 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();
}
}
}
  1. Compile

Compile the code at the command prompt by executing the following:

Terminal window
\...\csc.exe /reference:TaxControls.dll Zips.cs
Terminal window
javac -classpath .;bigloo_u.zip;TaxControls.jar Zips.java
  1. Run

Run the code by typing:

Terminal window
Zips
Terminal window
java -classpath .;bigloo_u.zip;TaxControls.jar Zips