Write a method named pow
that accepts a base and an exponent
as parameters and returns the base raised to the given power. For example,
the call pow(3, 4)
returns 3 * 3 * 3 * 3 or 81. Do not
use Math.pow
in your solution; use a cumulative algorithm
instead. Assume that the base and exponent are non-negative. See ch4 lecture
slides on cumulative sums for a hint.