Create a new class called Calculator with the A static method called powerInt

 Create a new class called Calculator with the following methods: 

1. A static method called powerInt(int num1,int num2)

This method should return num1 to the power num2.

2. A static method called powerDouble(double num1,int num2).

This method should return num1 to the power num2.

3. Invoke both the methods and test the functionalities.

Hint: Use Math.pow(double,double) to calculate the power.



Source code:

1:  package ClassesAndObjects;  
2:  public class Calculator {  
3:       public static int powerInt(int num1, int num2) {  
4:            return (int) Math.pow(num1, num2);  
5:       }  
6:       public static double powerDouble(double num1, int num2) {  
7:            return Math.pow(num1, num2);  
8:       }  
9:       public static void main(String[] args) {  
10:            // TODO Auto-generated method stub  
11:            System.out.println(powerInt(12, 3));  
12:            System.out.println(powerDouble(1.5, 2));  
13:       }  
14:  }