import java.util.Scanner;
public class Exponents
{
public static void main (String []args)
{
int base = 0;
int exponent = 0;
Scanner input = new Scanner(System.in);
System.out.println("Please enter a base: ");
base = input.nextInt();
System.out.println("Please enter a Exponent: ");
exponent = input.nextInt();
int total = integerPower(base, exponent);// call the method and pass two values
System.out.println("The exponentiation of the number is:" + total); // print out the results from method
} // end of main method
public static int integerPower(int b, int e) // custom method
{
int c = 1; // set my counter to 1
int base = b; // determain a base
while (c < e) // do this while this condition is true
{
b = base * b;
c++;
}
return b; // return back b
} // end of integerPower Method
}// end of class
I always had a passion for the field of STEM (Science, Technology, Engineering, and Math) and I knew I wanted to do something to make a difference in the world. I just didn’t know where to start. I was an immigrant in a new country, grew up in a tough environment, and wasn’t sure how… Read More