Question: (IN JAVA) Write a method integerPower(base, exponent) that returns the value of base exponent (2 pts). For example, integerPower(3, 4) returns 81. Assume thatexponent is
(IN JAVA)
Write a method integerPower(base, exponent) that returns the value of baseexponent (2 pts).
For example, integerPower(3, 4) returns 81. Assume thatexponent is a positive nonzero integer, and base is an integer. Method integer should use for or while loop to control the calculation. Do not use any Math library methods. Incorporate this method into a program class and invoke this method with different combinations of input values at least 4 times.
Please use printf() method to generate the multiple outputs from the sequence of the method invocations for integerPower(num1, num2). Remark: The placeholder for boolean value is %b.
System.out.printf("integerPower(%d, %d) returns %b.", 3, 4, integerPower(3, 4));
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
