Write a program to compute the total volume of N spheres, where N is a number...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
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. 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.
Expert Answer:
Answer rating: 100% (QA)
Here is a sample Java program that fulfills the requirements of ... View the full answer
Related Book For
Fundamentals Of Electric Circuits
ISBN: 9780073301150
3rd Edition
Authors: Matthew Sadiku, Charles Alexander
Posted Date:
Students also viewed these programming questions
-
Cherokee Company began operations when it issued common stock for $100,000 cash. It paid $90,000 cash in advance for a one- year contract to lease delivery equipment for the business. It signed the...
-
Let A, B be sets. Define: (a) the Cartesian product (A B) (b) the set of relations R between A and B (c) the identity relation A on the set A [3 marks] Suppose S, T are relations between A and B, and...
-
re Regular Languages and Finite Automata (a) Let L be the set of all strings over the alphabet {a, b} that end in a and do not contain the substring bb. Describe a deterministic finite automaton...
-
The compound bow in the previous problem requires 152 J of work to draw the string back to x = 0.540 m, at which point the archer need only exert 250 N of force to hold the string in place. (a)...
-
When do firms pay efficiency wages? What is the relationship between moral hazard and efficiency wages?
-
A direction field for the differential equation is y' = x cos y is shown.
-
Go back and read the case of Aspire CoffeeWorks in Chapter
-
Christina Reis is a photographer who owns Lola Lemon Photography. This is the first month of operations. The following are the transactions for the month of September. a. On September 1, Reis...
-
D Payback, Accounting Rate of Return, Present Value, Net Present Value, Internal Rate of Return For discount factors use Exhibit 128.1 and Exhibit 128.2. All scenarios are independent of all other...
-
High School Competency Test A mandatory competency test for high school sophomores has a normal distribution with a mean of 475 and a standard deviation of 104. Round the final answers to the nearest...
-
Suppose that an airplane flying 60 m/s, at a height of 300m, dropped a sack of flour. How far from the point of release would the sack have traveled when it struck the ground? In many locations, old...
-
es The following selected transactions relate to liabilities of United Insulation Corporation. United's fiscal year ends on December 31. 2024 January 13 Negotiated a revolving credit agreement with...
-
As a result of winning the Gates Energy Innovation Award, you are awarded a growing perpetuity. The first payment will occur in a year and will be for $25,000. You will continue receiving monetary...
-
Suppose now that the same ball, released from the same ramp (92 cm high) struck a coin placed 25 cm from the end of the ramp. a) What was the ball's horizontal velocity? b) How long did it take for...
-
Through a current loop with a radius of 1.5 cm, the magnetic flux density decreases from 85 mT to 15 mT in the time 50 ms. The magnetic field is directed from the lock perpendicular to the plane of...
-
Given the following information, calculate the OPERATING CYCLE.Be sure to keep your interim calculations on hand. Beginning inventory = $50,000 Ending inventory = $45,000 Beginning Accounts...
-
Baxter, Inc., owns 90 percent of Wisconsin, Inc., and 20 percent of Cleveland Company. Wisconsin, in turn, holds 60 percent of Clevelands outstanding stock. No excess amortization resulted from these...
-
The following information is provided for Shaq Co. for the new product it recently introduced. Total unit cost \($30\) Desired ROI per unit \($10\) Target selling price \($40\) What would be Shaq...
-
Sprague Company is considering developing a new product. The company has gathered the following information on this product. Expected total unit cost Estimated investment for new product Desired ROI...
-
Bristle Brush Company operates in a state where corporate taxes and workers' compensation insurance rates have recently doubled. Bristle's president has just assigned you the task of preparing an...
Study smarter with the SolutionInn App