Question //define Programming Week 2 //save file as Week4 discussion // Returns base ^ exponent.// Precondition: exponent >= 0public static int pow (int base, int exponent) {if (exponent == 0) {// base case; any number to 0th power is 1return 1;} else {// recursive case: x^y = x * x^(y-1)return base * pow(base, exponent – 1);}} //code ends here I am trying to have a .class file with my .java file but I have tried everything I can and it keeps giving me errors.
Question
//define Programming Week 2//save file as Week4 discussion// Returns base ^ exponent.//
Precondition: exponent >= 0public static int pow (int base, int exponent) {if (exponent == 0) {// base case; any number to 0th power is 1return 1;} else {// recursive case: x^y = x * x^(y-1)return base * pow(base, exponent – 1);}}
//code ends here
I am trying to have a .class file with my .java file but I have tried everything I can and it keeps giving me errors.
Looking for a Similar Assignment? Order now and Get 10% Discount! Use Coupon Code "Newclient"
