Input, Output and Processing Create a console program named SphereCalc that that calculates both the volume...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Input, Output and Processing Create a console program named SphereCalc that that calculates both the volume and the area of a sphere, given a radius r. The volume V, and the area A, are calculated by using the formulas: A = 4πr2 ● 4 .3 V = πr³ and · ● 3 Here is what the output of your program should look like: r CS170: Sphere Calculator ### Enter the radius of the sphere: 8.3 Sphere Volume: 2395.0957848241965 Sphere Surface Area: 865.6972716232036 Line #1 and all prompts and output should appear exactly as shown. Line #2 is the same length as Line #1 and uses the # symbol. Lines #3 and #5 are blank while line #4 begins with a prompt. Input should occur on the same line as the prompt. #6 and #7 must contain "Sphere Volume: " and "Sphere Surface Area: The volume and area should not be formatted. Just use concatenation. • Use Math.PI, not a literal value for pi. Use Math.pow(). Remember the difference between integer and real division. 11 Input, Output and Processing Create a console program named SphereCalc that that calculates both the volume and the area of a sphere, given a radius r. The volume V, and the area A, are calculated by using the formulas: A = 4πr2 ● 4 .3 V = πr³ and · ● 3 Here is what the output of your program should look like: r CS170: Sphere Calculator ### Enter the radius of the sphere: 8.3 Sphere Volume: 2395.0957848241965 Sphere Surface Area: 865.6972716232036 Line #1 and all prompts and output should appear exactly as shown. Line #2 is the same length as Line #1 and uses the # symbol. Lines #3 and #5 are blank while line #4 begins with a prompt. Input should occur on the same line as the prompt. #6 and #7 must contain "Sphere Volume: " and "Sphere Surface Area: The volume and area should not be formatted. Just use concatenation. • Use Math.PI, not a literal value for pi. Use Math.pow(). Remember the difference between integer and real division. 11 Input, Output and Processing Create a console program named SphereCalc that that calculates both the volume and the area of a sphere, given a radius r. The volume V, and the area A, are calculated by using the formulas: A = 4πr2 ● 4 .3 V = πr³ and · ● 3 Here is what the output of your program should look like: r CS170: Sphere Calculator ### Enter the radius of the sphere: 8.3 Sphere Volume: 2395.0957848241965 Sphere Surface Area: 865.6972716232036 Line #1 and all prompts and output should appear exactly as shown. Line #2 is the same length as Line #1 and uses the # symbol. Lines #3 and #5 are blank while line #4 begins with a prompt. Input should occur on the same line as the prompt. #6 and #7 must contain "Sphere Volume: " and "Sphere Surface Area: The volume and area should not be formatted. Just use concatenation. • Use Math.PI, not a literal value for pi. Use Math.pow(). Remember the difference between integer and real division. 11
Expert Answer:
Related Book For
Posted Date:
Students also viewed these programming questions
-
Managing Scope Changes Case Study Scope changes on a project can occur regardless of how well the project is planned or executed. Scope changes can be the result of something that was omitted during...
-
TED AND ALICES HOUSE PURCHASE DECISION Ted and Alice are a young couple who have been living in an apartment for the first two years of their marriage. They would like to buy their first house, but...
-
Design a linear-time algorithm to sort an array of Comparable objects that is known to have at most three distinct values. (Edsger Dijkstra named this the Dutch-national-flag problem because the...
-
1. A primary difficulty in energy production by fusion is (a) The scarcity of necessary fuel. (b) The disposal of radioactive by-products produced. (c) The high temperatures necessary to overcome the...
-
For the following exercises, assume is opposite side a, is opposite side b, and is opposite side c. Solve each triangle, if possible. Round each answer to the nearest tenth. To find the distance...
-
On February 16, 2005, Joseph and Margaret Buset borrowed $192,000 from Fremont Investment & Loan (the Originator). The loan was secured by a mortgage on a residential condominium. The mortgage named...
-
You have been asked to audit Greystone Company. During the course of your audit, you are asked to prepare comparative data from the company's inception to the present. You have determined the...
-
You have been hired as a data analyst for the company. Adventure Works managers have requested that you analyze 3 years of sales and cost data to help them answer specific business questions. In the...
-
E has a $ 1 0 , 0 0 0 traditional whole life policy with a $ 4 , 0 0 0 cash value. Premiums paid to date are $ 3 , 5 0 0 . If the policy lapses with a $ 4 , 0 0 0 loan outstanding, what amount will...
-
You must write a public abstract class named BankAccount with fields and methods as defined below. BankAccount < > # accountID: String # interestRate: double # currentBalance : int + credit(pennies:...
-
The main memory of a computer is organized as 256 blocks, with a block size of 8 words. The cache has 16 block frames. For the questions below, show the mappings from the numbered blocks of main...
-
a. The spending-Income multiplier reduces spending-income changes into larger changes in aggregate supply, causing cost-push Inflation. magnifies spending-income changes into greater changes in...
-
You are a young design engineer working for a consulting firm. You have been asked to develop a specification for the installation and construction of a tall sign for a local Starbucks. The sign will...
-
Stock A has an expected return of 16 percent and Stock B has an expected return of 8 percent. However, the risk of Stock A as measured by its variance is 3.2 times that of Stock B. If the two stocks...
-
Given the trial balance and adjustment columns of the worksheet, complete the adjusted trial balance column for the company. Trial Adjusted Balance Adjustments Trial Balance Accounts DR CR DR CR DR...
-
The swap spread is the difference between the swap rate and the equivalent-maturity Treasury bond yield. Explain why a widening swap spread may be a signal of deteriorating economic conditions. Plot...
-
Two trigonometric identities are given by: (a) tan 3x = 3tanx tan3x/1 3tan2x (b) cos 4x = 8(cos4x - cos2x) + 1 For each part, verify that the identity is correct by calculating the values of the...
-
A paper cup shaped as a frustum of a cone with R2 = 2R1 is designed to have a volume of 250 cm3. Determine R1, R2, and h such that the least amount of paper will be used for making the cup. The...
-
Define the variables x and y as x = 5.1 and y = 4.2, then evaluate: (a) 3/4 xy 7x/y2 + xy (b) (xy)2- x + y/(x-y)l2 + x + y/2x - y
-
Go to the PMI Web site and examine the link Membership. What do you discover when you begin navigating among the various chapters and cooperative organizations associated with the PMI? How does this...
-
Go to http://www.pmi.org/business-solutions/casestudies and examine some of the cases included on the Web page. What do they suggest about the challenges of managing projects successfully? The...
-
Using your favorite search engine (Google, Yahoo!, etc.), type in the keywords project and project management. Randomly select three of the links that come up on the screen. Summarize what you find.
Study smarter with the SolutionInn App