allExponent: You are given a base value and an exponent value. You need to calculate the value of the base raised to the power of the exponent. You need to implement the allExponent method which takes the base value and the exponent value as input and returns the value of the base raised to the power of the exponent.
class Solution
{
float allExponent(int baseValue, int exponentValue)
{
float res = 1;
if(exponentValue >=0)
{
Exponent exp = new Exponent(baseValue, exponentValue);
res = (float)exp.positiveExponent();
}
else
{
// write your code here for negative exponentInput
Exponent exp = new Exponent(baseValue, exponentValue);
res = (float)exp.negativeExponent();
}
return res;
}
}
Happy Learning – If you require any further information, feel free to contact me.