Advertisement
veronikaaa86

11. Refactor Volume of Pyramid

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