Write a class that has the following methods isPrime This me
Solution
/**
 * @author
 *
 */
 public class question2 {
   /**
    * @param args
    */
    public static void main(String[] args) {
        System.out.println(\" is 17 is prime ?\" + isPrime(17));
        System.out.println(\" is 14 is prime ?\" + isPrime(14));
        System.out.println(\" Number of vowel in AbcdiO :\" + vowels(\"AbcdiO\"));
        System.out
                .println(\" Compound Interest of compoundInterest(7500, 4, 2) :\"
                        + compoundInterest(7500, 4, 2));
       System.out.println(\" Factorial of 5 :\" + factorial(5));
        System.out.println(\" eEstimate(5) :\" + eEstimate(5));
}
   /**
    * method to check the given number is prime or not
    *
    * @param number
    * @return
    */
    public static boolean isPrime(int number) {
        int i, m = 0, flag = 0;
       m = number / 2;
        for (i = 2; i <= m; i++) {
            if (number % i == 0) {
               flag = 1;
                break;
            }
        }
        if (flag == 0)
            return true;
        else
            return false;
}
   /**
    * method to count the vowels in the string
    *
    * @param str
    * @return
    */
    public static int vowels(String str) {
        int vowelCount = 0;
       for (int i = 0; i < str.length(); i++) {
            if (str.charAt(i) == \'a\' || str.charAt(i) == \'e\'
                    || str.charAt(i) == \'i\' || str.charAt(i) == \'o\'
                    || str.charAt(i) == \'u\' || str.charAt(i) == \'A\'
                    || str.charAt(i) == \'E\' || str.charAt(i) == \'I\'
                    || str.charAt(i) == \'O\' || str.charAt(i) == \'U\') {
               vowelCount++;
            }
        }
        return vowelCount;
}
   /**
    * method to find the compound interest
    *
    * @param principal
    * @param rate
    * @param time
    * @return
    */
    public static double compoundInterest(double principal, double rate,
            double time) {
        double compoundInterest = principal * Math.pow((1 + rate / 100), time);
        return compoundInterest;
}
   /**
    * method to find the factorial of given value
    *
    * @param n
    * @return
    */
    public static int factorial(int n) {
       int fact = 1;
        for (int i = 2; i <= n; i++) {
            fact *= i;
        }
        return fact;
    }
   /**
    * method to find the estimate the value
    *
    * @param n
    * @return
    */
    public static double eEstimate(int n) {
       double estimateValue = 0;
        for (int i = 1; i <= n; i++) {
            estimateValue += (double) 1 / factorial(i);
        }
        return estimateValue;
    }
}
OUTPUT:
is 17 is prime ?true
 is 14 is prime ?false
 Number of vowel in AbcdiO :3
 Compound Interest of compoundInterest(7500, 4, 2) :8112.000000000001
 Factorial of 5 :120
 eEstimate(5) :1.7166666666666668



