Question: How to call these static method into the main class and print them? package auxiliarymath; public class AuxiliaryMathDemo { public static boolean isPalindrome(int n) {

How to call these static method into the main class and print them?

package auxiliarymath;

public class AuxiliaryMathDemo {

public static boolean isPalindrome(int n) { String palindrome = Integer.toString(n); boolean something = true; for(int i = 0; i < palindrome.length() && something; i++) { if(palindrome.charAt(i) != palindrome.charAt(palindrome.length() - i -1)) { something = false; } } if (something) { return true; } else return false; } public static int fibonacci(int n) { int a = 0; int b = 1; int c = a+b;

while (a < n) { System.out.println(a); a = a + b; b = a - b; }

return a;

} public static int gCD(int a, int b) { int gCD; if (a == 0 || b == 0) { gCD = Math.abs(a + b); } else { a = Math.abs(a); b = Math.abs(b); } while( b!= 0) { int r = a%b; a = b; b = r; } return a; }

public static double powInt(double a, int n) { double term = 1; if(n>0) { for(int i=1; i<=n; i++) { term *= a; } return term; } else { n *= -1; for(int i=1; i<=n; i++) { term *= a; } return 1/term; }

} }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!