Create a program that asks the user for two doubles. Your program will include a static method called doMath. It should take in the two doubles that the user entered, add them together, multiply the answer by 2, and then round to the nearest integer. You will return this integer. Your static method only performs the math and returns the integer answer. Your static method should not ask for input or print output. Your main method should ask for input, call the method and pass in the user’s two values, and then print the result that is returned from the doMath method. This program does not have to loop and does not have to have any try/catch blocks. Note: If your program does not perform the required tasks in a separate static method, you will not get any credit for this program. Example: Enter two numbers and I will do math things with them. >>>5.1 >>>3.2
-
Create a program that asks the user for two doubles.
-
Your program will include a static method called doMath. It should take in the two doubles that the user entered, add them together, multiply the answer by 2, and then round to the nearest integer. You will return this integer.
-
Your static method only performs the math and returns the integer answer.
-
Your static method should not ask for input or print output.
-
Your main method should ask for input, call the method and pass in the user’s two values, and then print the result that is returned from the doMath method.
-
This program does not have to loop and does not have to have any try/catch blocks.
Note: If your program does not perform the required tasks in a separate static method, you will not get any credit for this program.
Example:
Enter two numbers and I will do math things with them.
>>>5.1
>>>3.2
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images