7.1.2. WrMethods-WE1-P2ΒΆ
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
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 */
}
- public
- private
- String
- void
- nothing, empty
Q13: Fill in Blank A.
- public
- String
- double
- void
- nothing, empty
Q14: Fill in Blank B.
- public
- String
- double
- void
- nothing, empty
Q15: Fill in Blank C.
- public
- String
- double
- void
- nothing, empty
Q16: Fill in Blank D.
- public
- String
- double
- void
- nothing, empty
Q17: Fill in Blank E.
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 */
}
- public
- private
- String
- int
- double
Q18: Fill in Blank A.
- public
- private
- String
- int
- double
Q19: Fill in Blank B.
- String
- int
- double
- void
- nothing, empty
Q20: Fill in Blank C.
- String
- int
- double
- void
- nothing, empty
Q21: Fill in Blank D.
- String
- int
- double
- void
- nothing, empty
Q22: Fill in Blank E.