/** * Driver for genpoly Class * */ public class testGenpoly { /** * Pause waits for the user to type a return before continuing. * * @param No arguments. */ public static void pause(){ System.out.print("Type return to contd:"); System.out.flush(); try {System.in.read();} catch (Exception e){} } /** * The main entry point for the application. * This one computes the function "base^exponent" * where base and exponent are passed through the command line: * "driverGenpoly base expo" * E.g. driverGenpoly 2 0.5 * will compute the sqrt of 2. */ public static void main (String[] args) { double base=0.0, expo=0.0; if (args.length == 0) System.out.println("usage: driverGenpoly base expo"); try { base = (Double.valueOf(args[0])).doubleValue(); expo = (Double.valueOf(args[1])).doubleValue(); } catch(NumberFormatException e) { System.out.println("bad number format"); } double xx = Math.exp(expo * Math.log(base)); System.out.println(" Math.(base^exponent) = " + xx); genpoly gp = new genpoly(base, expo); System.out.println("gp.valAt(10) = "+ gp.valAt(10) +"\n"); System.out.println("gp.valAt(100) = "+ gp.valAt(100) +"\n"); System.out.println("gp.valAt(1000) = "+ gp.valAt(1000) +"\n"); pause(); } }