Untitled
unknown
plain_text
4 years ago
666 B
12
Indexable
import java.util.Scanner;
public class CalcPyramidVolume {
  public static double pyramidVolume(double length, double width, double height){
    double area = length*width;
    double div = (double)1/3;
    double volume = area*height*div;
    return volume;
  }
  public static void main (String [] args) {
    Scanner scnr = new Scanner(System.in);
    double userLength;
    double userWidth;
    double userHeight;
    userLength = scnr.nextDouble();
    userWidth = scnr.nextDouble();
    userHeight = scnr.nextDouble();
    System.out.println("Volume: " + pyramidVolume(userLength, userWidth, userHeight));
  }
}Editor is loading...