7.1.2. WrMethods-WE1-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-WE1-P2

GIVEN

For questions 13 through 17, fill in the blanks of the following code, which is a public method header that does not return anything but accepts as parameters 1 String and 2 doubles, and calculates the speed of a student running to the lunch line.

___A___ ___B___ thingy (___C___ one, ___D___ two, ___E___ three)
{
   /* logic */
}

GIVEN

For questions 18 through 22, fill in the blanks of the following code, which is a public that returns an integer and accepts as parameters one String and two integers (in that order) and calculates how many presents you will give this year.

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