7.2.2. WrMethods-WE2-P2ΒΆ

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


Methods-WE2-P2

GIVEN

For questions 33 through 37, fill in the blanks of the following code, which is a private method header that would work for this call:

robertsDay(5, 7, 22);
___A___ ___B___ robertsDay (___C___ one, ___D___ two, ___E___ three)
{
   /* logic */
}

GIVEN

For questions 38 through 40, fill in the blanks of the following code, which is a private method header that would work for this call:

double twelve;
int eleven;
eleven = getLength(twelve);
___A___ ___B___ getLength (___C___ one) { /* logic */ }

GIVEN

For questions 41 through 45, fill in the blanks of the following code, which is a public method header that would work for this call: obj.fixThings("no", true, "yes");

___A___ ___B___ fixThings (___C___ one, ___D___ two, ___E___ three)
{
   /* logic */
}
You have attempted of activities on this page