Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a Java Code.Write a code that calculates the volume of a 3d geometrical shape using a switch with 5 cases. The system should take

Write a Java Code.Write a code that calculates the volume of a 3d geometrical shape using a switch with 5 cases. The system should take a String input for each of the following cases; Cube, Rectangularprism, Cylinder, Cone, and Sphere. And 1 to 3 double inputs depending on each shape. The volume should be printed as a double with 2 digits after the decimal.

Cube: gets length as an input Rectangularprism: gets length, width, and height as an input Cylinder: gets radius, and height as an input Cone: gets radius and height as an input Sphere: gets radius as an input

Note: Take pi as 3.14

Input Format

For String = Cube, Rectangularprism, Cylinder, Cone, or Sphere. Double; radius, length, width, and/or height respectively.

Constraints

2 any double 100

Output Format

Print a single Volume, in the following format: XXX,00

Sample Input 0

Sphere 6 

Sample Output 0

902.06

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Spomenik Monument Database

Authors: Donald Niebyl, FUEL, Damon Murray, Stephen Sorrell

1st Edition

0995745536, 978-0995745537

More Books

Students also viewed these Databases questions

Question

State the uses of job description.

Answered: 1 week ago

Question

Explain in detail the different methods of performance appraisal .

Answered: 1 week ago