Enter the following code in a file named ‘States.cs’:
using System;using System.Collections;using TaxControls;class Test{ public static void Main(){ try { CTaxControl tc = new CTaxControl(); tc.DataFilename = "demo.tax"; Taxes txs = tc.Taxes IEnumerator inr = txs.GetEnumerator(); while(inr.MoveNext()){ Tax t = (Tax) inr.Current; if (t.TaxType == "S") { Console.WriteLine(t.Name); } } } catch (TaxControlException e) { Console.WriteLine(e.Message); } }}
Enter the following code in a file named ‘States.java’:
import com.boondocks.taxcontrols.TaxControl;import com.boondocks.taxcontrols.Taxes;import com.boondocks.taxcontrols.Tax;import com.boondocks.taxcontrols.TaxControlException;import java.util.Enumeration;public class States{ public static void main(String[] args){ TaxControl tc = new TaxControl(); tc.setDataFilename("demo.tax"); try{ Taxes txs = tc.getTaxes(); for (Enumeration e=txs.elements(); e.hasMoreElements(); ){ Tax t = (Tax)e.nextElement(); if (t.getTaxType().equals("S")) { System.out.println(t.getName()); } } } catch (TaxControlException e){ e.printStackTrace(); } }}
Compile the code at the command prompt by executing the following:
csc /reference:TaxControls.dll States.cs
javac -classpath .;bigloo_u.zip;TaxControls.jar States.java
Run the code by typing:
States
java -classpath .;bigloo_u.zip;TaxControls.jar States