Formula to calculate ellipse Area - Android java.lang

Android examples for java.lang:Math Formula

Description

Formula to calculate ellipse Area

Demo Code


import java.text.DecimalFormat;

public class Main{
    private static final double PI = 3.141592653589793;
    private static double result;
    public static double ellipseArea(double radius1, double radius2)
            throws InvalidInputException {
        if (radius1 >= 0 && radius2 >= 0) {
            result = (radius1 * radius2 * PI);
            return result;
        } else {/*from ww  w  .  j a  va  2s .  c  o m*/
            throw new InvalidInputException();
        }
    }
}

Related Tutorials