Section 9.7 Assessment: Writing Methods
Subgoals for Writing Methods.
- Define method header based on problem
- Define return statement at the end
-
Define method body/logic
- Determine types of logic (expression, selection, loop, etc.)
- Define internal variables
- Write statements
Exercises Exercises
2.
3.
4.
5.
Q5: Put the code in the right order to create a program that returns a double, and accepts as parameters 3 integers, and calculates the average of the inputs. There is also a main program that calls the method twice with different values.
You have attempted 1 of 2 activities on this page.