5. Write a program that has a main() method, and a method called calculate(). main() should...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
5. Write a program that has a main() method, and a method called calculate(). main() should call calculate() once, passing 3.0 and 5.0. calculate() should accept two parameters, both doubles. calculate() should multiply the two parameters, and display the result. calculate() should not return a value back to main(). 6. Modify the program your wrote for Problem 5 such that main() stores the return value of calculate() in a double variable called calcRet. Main() should display the calcRet after returning from calculate(). calculate() should be modified to return a double, not display any result, but instead return the result. 7. Modify the program you wrote in Problem 6 so that main() prompts the User for two doubles, and passed them to calculate() instead of the 3.0 and 5.0. 8. Modify the program you wrote in Problem 7 so that calculate() multiplies the two parameters, and then cubes the result, and then returns the result. 9. Modify the program you wrote in Problem 8, so that main() prompts the User for two doubles and one integer. main() passed the two doubles and the one integer to calculate(). calculate() accepts three parameters: two doubles and an integer. calculate() multiplies the two double parameters, and then multiplies the result by itself the number of times of the passed integer, and then returns the result. 5. Write a program that has a main() method, and a method called calculate(). main() should call calculate() once, passing 3.0 and 5.0. calculate() should accept two parameters, both doubles. calculate() should multiply the two parameters, and display the result. calculate() should not return a value back to main(). 6. Modify the program your wrote for Problem 5 such that main() stores the return value of calculate() in a double variable called calcRet. Main() should display the calcRet after returning from calculate(). calculate() should be modified to return a double, not display any result, but instead return the result. 7. Modify the program you wrote in Problem 6 so that main() prompts the User for two doubles, and passed them to calculate() instead of the 3.0 and 5.0. 8. Modify the program you wrote in Problem 7 so that calculate() multiplies the two parameters, and then cubes the result, and then returns the result. 9. Modify the program you wrote in Problem 8, so that main() prompts the User for two doubles and one integer. main() passed the two doubles and the one integer to calculate(). calculate() accepts three parameters: two doubles and an integer. calculate() multiplies the two double parameters, and then multiplies the result by itself the number of times of the passed integer, and then returns the result.
Expert Answer:
Answer rating: 100% (QA)
Problem 5 java public class Calculate public static void mainString args calculate30 50 public stati... View the full answer
Posted Date:
Students also viewed these programming questions
-
Would you accept this project or not? The project has investment of 70,000 as cash outflow with rate of 10% and cash inflow has these cash stream shown below. The desired payback period is 3 years....
-
Microkernel operating systems aim to address perceived modularity and reliability issues in traditional "monolithic" operating systems. (i) Describe the typical architecture of a microkernel...
-
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...
-
Discuss the salient features of the international monetary system.
-
Ms. Lynch has a choice of two assets: The first is a risk-free asset that offers a rate of return of rf, and the second is a risky asset (a china shop that caters to large mammals) that has an...
-
Leslie and Jason paid the following expenses during 2014: Interest on a car loan $ 100 Interest on lending institution loan .. --------- (used to purchase municipal bonds) 3,000 Interest on home...
-
What is involved in the decision-making process?
-
What is the relationship between the predictability of a firms cash inflows and its required level of net working capital? How are net working capital, liquidity, and risk of insolvency related?
-
Windsor Leasing Group signs an agreement on January 1, 2022, to lease equipment to Cole plc. The following information relates to this agreement. 1. The term of the non-cancelable lease is 6 years...
-
5. Here is a slightly complicated version to the game we discuss in the class. Suppose there are four questions Q1, Q2, Q3 and Q4, which are associated with a reward of $100, $1,000, $10, 000, and...
-
Rowland & Sons Air Transport Service, Incorporated, has been in operation for three years. The following transactions occurred in February: February 1 Paid $ 5 5 5 to rent equipment that was used and...
-
When Patey Pontoons issued 6 % bonds on January 1 , 2 0 2 4 , with a face amount of $ 6 0 0 , 0 0 0 , the market yield for bonds of similar risk and maturity was 7 % . The bonds mature December 3 1 ,...
-
Winston Campbell owns a MacBook Air. His brother, Frank, had a computer crash and desperately needed a computer to attend his college class in Canadian Criminal Justice. On Tuesday, January 19, 2021,...
-
Accountants distinguish between capital and revenue expenditures for some types of transactions. The entries for such transactions can be made to any one of the following accounts: Balance sheet...
-
Webb Corporation purchased equipment from Shaw Corporation on January 1 , 2 0 1 9 . Shaw accepted a 3 - year, non - interest - bearing note of $ 1 8 , 0 0 0 due December 3 1 , 2 0 2 1 , in exchange...
-
Mustang Manufacturing Company established the following standard price and cost data: $ 210 per unit 140 per unit 386,000 total 104,000 total Sales price Variable manufacturing overhead Fixed...
-
A firm offers two products for sale. The marginal cost of one product is new zero once the first unit has been produced. The marginal cost of the other product rises as output rises. What would be...
-
Juan Garcia, a newly minted MBA of a prestigious East Coast U.S. university, has been assigned to the treasury department at Cemex as part of his management training program's rotation. He has now...
-
Josh Miller is chief financial officer of a medium-sized Seattle-based medical device manufacturer. The company's annual sales of \(\$ 40\) million have been growing rapidly, and working capital...
-
Instruments du Rhone, S.A., as described in this chapter, decides not to change its domestic sales price of \( 12.80\) per unit within Europe but to raise its export price (in euros) from \( 12.80\)...
Study smarter with the SolutionInn App