Write Error Free Java Programto Following Things Prompts User Input Two Data Values Data V Q43786725
Write an error-free Java programto do the following things. • Prompts the user to input two data values. The data values should be the width of the base and height of a square pyramid. In the figure below, the height is denoted by hand we assume the base is a square. From the main program, call a method that calculates the volume of the pyramid. The method should be called vol. It should have two input parameters (the aforementioned width and height) and return a float (double) value that is the volume. Note that the volume will be a positive number (or zero). From the main program, call a second method that cal culates the surface area of the pyramid. The main module should print a message saying something like this CO Input base width: 8.6 DO Input height: 12 The volume of a pyramid with width = 8.6 and height 12.0 is 295.84 cm^3. The surface area = 293.21109258564707 cm^2. In summary, the programmer needs to write two methods and call two methods. Show transcribed image text Write an error-free Java programto do the following things. • Prompts the user to input two data values. The data values should be the width of the base and height of a square pyramid. In the figure below, the height is denoted by hand we assume the base is a square. From the main program, call a method that calculates the volume of the pyramid. The method should be called vol. It should have two input parameters (the aforementioned width and height) and return a float (double) value that is the volume. Note that the volume will be a positive number (or zero). From the main program, call a second method that cal culates the surface area of the pyramid. The main module should print a message saying something like this CO Input base width: 8.6 DO Input height: 12 The volume of a pyramid with width = 8.6 and height 12.0 is 295.84 cm^3. The surface area = 293.21109258564707 cm^2. In summary, the programmer needs to write two methods and call two methods.
Expert Answer
Answer to Write an error-free Java programto do the following things. • Prompts the user to input two data values. The data valu…
OR