The set of services that each module provides to its ____(a)____ (i.e. the purpose of the module as it relates to other modules) is called its ____(b)____ . The corresponding services are said to be ____(c)____ by the module and ____(d)____ by its ____(a)____ The way these services are accomplished by the module is called the module's ____(e)____ . A clear distinction between the ____(b)____ of a module and its ____(e)____ is a key aspect of good design, because it supports the ____(f)____ .
The pow method is defined to take two integer parameters, and
return the result of raising the first parameter to the
power of the second paramter.
Assume that the pow method is invoked elsewhere in
the program with this statement:
System.out.println(pow(i, j));,
where i and j are ints.
double pow(int a, int b)
{
boolean inverse = false;
if (a < 0)
{
inverse = true;
b = -b;
}
double result = 1.0;
for (int i=0; i<b; i++)
result *= a;
if (inverse)
result = 1.0/result;
return result;
}