Write a Java class called PyramidVolume that reads from the user 2 integers represent area of the base (B) and the height of a pyramid (h). Then calculates and prints the volume of this pyramid (rounded to 1 decimal place) according to the following formula: volume = (1/3) h B Note: If the user enters any non-positive value (i.e. less than or equal to zero), an error message should be displayed and nothing should be calculated. Paragraph - B I && 4

EBK JAVA PROGRAMMING
8th Edition
ISBN:9781305480537
Author:FARRELL
Publisher:FARRELL
Chapter2: Using Data
Section: Chapter Questions
Problem 4PE
icon
Related questions
Question
f
on
ㄱ
Write a Java class called PyramidVolume that reads from the user 2 integers represent
area of the base (B) and the height of a pyramid (h).
Then calculates and prints the volume of this pyramid (rounded to 1 decimal place)
according to the following formula:
volume = (1/3) h B
Note:
If the user enters any non-positive value (i.e. less than or equal to zero), an error message
should be displayed and nothing should be calculated.
EFEE
Paragraph
O
B I
][
101°F
4
4:00 PM
4/28/2022
Transcribed Image Text:f on ㄱ Write a Java class called PyramidVolume that reads from the user 2 integers represent area of the base (B) and the height of a pyramid (h). Then calculates and prints the volume of this pyramid (rounded to 1 decimal place) according to the following formula: volume = (1/3) h B Note: If the user enters any non-positive value (i.e. less than or equal to zero), an error message should be displayed and nothing should be calculated. EFEE Paragraph O B I ][ 101°F 4 4:00 PM 4/28/2022
Expert Solution
steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
Adjacency Matrix
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781305480537
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT