7.2.1. WrMethods-WE2-P1ΒΆ

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-P1

GIVEN

For questions 23 through 27, fill in the blanks of the following code, which is a public method header that would work for this call:

String fob;
fob = obj.journey(4.1, 6.6, 8);
___A___ ___B___ journey (___C___ one, ___D___ two, ___E___ three)
{
   /* logic */
}

GIVEN

For questions 28 through 32, fill in the blanks of the following code, which is a public method header that would work for this call:

String trouble;
trouble = obj.gasPrice(56, 22, "diesel");
___A___ ___B___ gasPrice (___C___ one, ___D___ two, ___E___ three)
{
   /* logic */
}
You have attempted of activities on this page