7.2.2. WrMethods-WE2-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-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 */
}
- public
- private
- String
- void
- nothing, empty
Q33: Fill in Blank A.
- public
- String
- double
- int
- void
Q34: Fill in Blank B.
- public
- String
- double
- int
- void
Q35: Fill in Blank C.
- public
- String
- double
- int
- void
Q36: Fill in Blank D.
- public
- String
- double
- int
- void
Q37: Fill in Blank E.
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 */ }
- public
- private
- String
- int
- double
Q38: Fill in Blank A.
- public
- private
- String
- int
- double
Q39: Fill in Blank B.
- String
- int
- double
- void
- nothing, empty
Q40: Fill in Blank C.
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 */
}
- public
- private
- String
- void
- nothing, empty
Q41: Fill in Blank A.
- public
- String
- double
- int
- void
Q42: Fill in Blank B.
- public
- String
- double
- int
- void
Q43: Fill in Blank C.
- public
- String
- double
- int
- void
Q44: Fill in Blank D.
- public
- String
- double
- int
- void
Q45: Fill in Blank E.