Question: 1 . Write a program that computes the volume of a sphere with radius 1 0 . a . Define a constant float called PI

1. Write a program that computes the volume of a sphere with radius 10.
a. Define a constant float called PI with the value of 3.14.
b. Define a constant byte called FOUR with the value of 4.
c. Define a constant byte called THREE with the value of 3.
d. Define a byte variable called radius with the value of 10.
e. Define a double variable called volume and set it equal to FOUR/THREE * PI * Math.pow(radius,3)
f. Print to the screen the volume of the sphere.
Note: You will need to use casting to make sure FOUR/THREE does not evaluate to 1. It should evaluate to 1.333.
2. Compile and test your code in NetBeans. Submit your .java file and a screenshot of passing all test cases through Blackboard.

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!