Enter the following code in a file named ‘List.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; Console.WriteLine(t.Name); } } catch (TaxControlException e) { Console.WriteLine(e.Message); } }}
Enter the following code in a file named ‘List.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 List{ 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(); 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 List.cs
javac -classpath .;bigloo_u.zip;TaxControls.jar List.java
Run the code by typing:
List
java -classpath .;bigloo_u.zip;TaxControls.jar List