Formula to calculate prism Volume - Android java.lang

Android examples for java.lang:Math Formula

Description

Formula to calculate prism Volume

Demo Code


import java.text.DecimalFormat;

public class Main{
    private static double result;
    public static double prismVolume(double length, double width,
            double height) throws InvalidInputException {
        if (length >= 0 && width >= 0 && height >= 0) {
            result = (length * width * height);
            return result;
        } else {//from   w  w w  .  ja  v a2 s .  com
            throw new InvalidInputException();
        }
    }
}

Related Tutorials