Listing 3. The IntegrationApp Class: The Client Application
public class IntegrationApp
{
public static void main(String[] args)
{
if(args.length < 3)
{
System.out.println("Usage: Integration a b n");
System.exit(1);
}
double a = Double.parseDouble(args[0]);
double b = Double.parseDouble(args[1]);
int n = Integer.parseInt(args[2]);
String function = "f(x) = sin(x)";
System.out.println("-- Numerical Integration --");
System.out.println("Function: " + function);
System.out.println("a = " + a);
System.out.println("b = " + b);
System.out.println("n = " + n);
TrapezoidRule trapezoid = new TrapezoidRule(a,b,n);
System.out.println("Trapezoid Rule: area = " + trapezoid.integrate());
SimpsonsRule simpsons = new SimpsonsRule(a,b,n);
System.out.println("Simpson's Rule: area = " + simpsons.integrate());
}
}
New on the Java Boutique:
New Review:
Time Management Made Easy with the Quartz Enterprise Job Scheduler
Why not just use the Java timer API? This open source scheduling
API boasts simplicity, ease-of-integration, a well-rounded feature
set, and it's free!
New Applet:
Reverse Complement
Reverse Complement is a simple applet that converts DNA or RNA
sequences into three useful formats.
Elsewhere on internet.com:
WebDeveloper Java
Lots of Java information on webdeveloper.com
WDVL Java
Thorough Java resource at the Web Developer's Virtual Library.
ScriptSearch Java
Hundreds of free Java code files to download.
jGuru: Your View of the Java Universe
Customizable portal with online training, FAQs, regular news updates, and tutorials.
|