Create a program that calculates the volume of a rectangular prism. The program should take user input for length, width, and height, and then use a method to compute and display the volume. Fill in the blanks in the code to make it work correctly.
Calling methods
Prism puzzler: Boxy volume adventure
Report a typo
Fill in the gaps with the relevant elements
class RectangularPrism {
public main(String[] args) {
java.util.Scanner scanner = new java.util.Scanner(System.in);
length = scanner.nextInt();
int width = scanner.nextInt();
int height = scanner.nextInt();
System.out.println("Volume: " + calculateVolume(length, width, height));
}
public static int calculateVolume(int l, int w, int h) {
l * w * h;
}
}Create a free account to access the full topic
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.