Formula to calculate cone Surface - Android java.lang

Android examples for java.lang:Math Formula

Description

Formula to calculate cone Surface

Demo Code


import java.text.DecimalFormat;

public class Main{
    private static final double PI = 3.141592653589793;
    private static double result;
    public static double coneSurface(double radius, double slant)
            throws InvalidInputException {
        if (radius >= 0 && slant >= 0) {
            result = (radius * radius * PI) + (radius * slant * PI);
            return result;
        } else {/*from  ww w .jav  a 2  s. c o m*/
            throw new InvalidInputException();
        }
    }
}

Related Tutorials