Skip to main content

Section 7.9 Assessment: Writing Methods

Subsection 7.9.1 Subgoals for Writing Methods

  1. Define method header based on problem

  2. Define return statement at the end

  3. Define method body/logic

    1. Determine types of logic (expression, selection, loop, etc)

    2. Define internal variables

    3. Write statements

Exercises 7.9.2 Exercises

1.

Q1: Fill in the blanks for a public method header that would work for this call:

2.

Q2: Fill in the blanks for a public method header that would work for this call:

3.

Q3: Fill in the blanks for a private method header that returns a String and accepts two integer parameters.

4.

Q4: Fill in the blanks for a private method header that returns nothing and takes no parameters.

You have attempted of activities on this page.