Untitled

mail@pastecode.io avatar
unknown
plain_text
3 years ago
666 B
4
Indexable
Never
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));

  }

}