Question: JAVA Chapter 2 Lab Java Fundamentals 15 Task #4 Using Predefined Math Functions 1. 2. Add a line that prompts the user to enter the

JAVA JAVA Chapter 2 Lab Java Fundamentals 15 Task #4 Using Predefined Math

Chapter 2 Lab Java Fundamentals 15 Task #4 Using Predefined Math Functions 1. 2. Add a line that prompts the user to enter the diameter of a sphere, Read in and store the number into a variable called diameter (you will need to declare any variables that you use). The diameter is twice as long as the radius, so calculate and store the radius in an appropriately named variable. The formula for the volume of a sphere is 3. 4. V = Convert the formula to Java and add a line which calculates and stores the value of volume in an appropriately named variable. Use Math.PI for 7 and Math.pow to cube the radius. 5. Print your results to the screen with an appropriate message. 6. Compile. debug, and run using the following test data and record the results. Diameter Volume (hand calculated) Volume (resulting output) 2 25.4 875.000

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!