Question: Write a program to compute the total volume of N spheres, where N is a number entered by the user. For each sphere, ask

Write a program to compute the total volume of N spheres, where N is a number entered by the user. For each sphere, ask for the radius, compute the volume, and add that volume to the total. Each time you ask the user to enter the radius, if the user does not enter a positive number, display an error message and ask them again until they enter a positive number. (If the radius is not positive, then do not compute the volume and do not count that as one of the N spheres. Allow the user to enter N positive radii.) To keep this assignment shorter, you do not need to check for a positive number for N - the number of spheres. Display the final total volume (and do not display the cumulative total after each sphere). The volume of a sphere is: where v = (4/3)r v volume (in cubic inches) r radius (in inches) You do not have to turn in a java file. This is just a homework assignment and not a "program". Submit a copy of the code as text, and I will look it over to make comments.
Step by Step Solution
3.34 Rating (157 Votes )
There are 3 Steps involved in it
Here is a sample Java program that fulfills the requirements of ... View full answer
Get step-by-step solutions from verified subject matter experts
Document Format (2 attachments)
663dffe087e9d_960627.pdf
180 KBs PDF File
663dffe087e9d_960627.docx
120 KBs Word File
