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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started