computer science homework
final static Scanner cin = new Scanner(System.in); /** * @param args the command line arguments */ public static void main(String[] args) { // TODO code application logic here out.print("CPS 151 ICA 04 Power calculation by YOUR NAME\n\n"); out.print("Enter base (double): "); double base = cin.nextDouble(); out.print("Enter the power to raise it to (positive int): "); int expo = cin.nextInt(); double result1 = slowPower(base, expo); double result2 = fastPower(base, expo); out.println("Result from slow power = " + result1); out.println("Result from fast power = " + result2); out.println("Result from math.pow = " + Math.pow(base, expo)); } // end main private static double slowPower(double base, int expo) { if (expo == 0) return 1.0; else return 1.0; // stub, replace with correct recursion pattern } // end method private static double fastPower(double base, int expo) { if (expo == 0) return 1.0; else return 1.0; // stub, replace with correct recursion pattern } // end method