7.2.1. WrMethods-WE2-P1ΒΆ
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-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 */
}
- public
- private
- String
- void
- nothing, empty
Q23: Fill in Blank A.
- public
- String
- double
- int
- void
Q24: Fill in Blank B.
- public
- String
- double
- int
- void
Q25: Fill in Blank C.
- public
- String
- double
- int
- void
Q26: Fill in Blank D.
- public
- String
- double
- int
- void
Q27: Fill in Blank E.
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 */
}
- public
- private
- String
- int
- double
Q28: Fill in Blank A.
- public
- private
- String
- int
- double
Q29: Fill in Blank B.
- String
- int
- double
- void
- nothing, empty
Q30: Fill in Blank C.
- String
- int
- double
- void
- nothing, empty
Q31: Fill in Blank D.
- String
- int
- double
- void
- nothing, empty
Q32: Fill in Blank E.
You have attempted of activities on this page