Didart

Refactor Volume Of Pyramid

May 13th, 2021
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.65 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class RefactorVolumeOfPyramid {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner(System.in);
  6.  
  7.         double length, width, height = 0;
  8.        
  9.         length = Double.parseDouble(scanner.nextLine());
  10.         System.out.print("Length: ");
  11.        
  12.         width = Double.parseDouble(scanner.nextLine());
  13.         System.out.print("Width: ");
  14.        
  15.         height = Double.parseDouble(scanner.nextLine());
  16.         System.out.print("Height: ");
  17.        
  18.         double volume = (length * width * height) / 3;
  19.         System.out.printf("Pyramid Volume: %.2f", volume);
  20.     }
  21. }
  22.  
Advertisement
Add Comment
Please, Sign In to add comment