Question: 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()

5. Write a program that has a main() method, and a method

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.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Problem 5 java public class Calculate public static void mainString args calculate30 50 public stati... View full answer

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 Programming Questions!