Skip to main content\(
\newcommand{\lt}{<}
\newcommand{\gt}{>}
\newcommand{\amp}{&}
\definecolor{fillinmathshade}{gray}{0.9}
\newcommand{\fillinmath}[1]{\mathchoice{\colorbox{fillinmathshade}{$\displaystyle \phantom{\,#1\,}$}}{\colorbox{fillinmathshade}{$\textstyle \phantom{\,#1\,}$}}{\colorbox{fillinmathshade}{$\scriptstyle \phantom{\,#1\,}$}}{\colorbox{fillinmathshade}{$\scriptscriptstyle\phantom{\,#1\,}$}}}
\)
Section 9.4 Write-Methods-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
Subsection 9.4.1
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);
_______ _______ journey (_______ one, _______ two, _______ three)
A B C D E
{
/* logic */
}
Exercises Exercises
1.
Q23: Fill in Blank A.
public
private
String
void
nothing, empty
2.
Q24: Fill in Blank B.
public
String
double
int
void
3.
Q25: Fill in Blank C.
public
String
double
int
void
4.
Q26: Fill in Blank D.
public
String
double
int
void
5.
Q27: Fill in Blank E.
public
String
double
int
void
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 (_______ one, _______ two, _______ three)
A B C D E
{
/* logic */
}
6.
Q33: Fill in Blank A.
public
private
String
void
nothing, empty
7.
Q34: Fill in Blank B.
public
String
double
int
void
8.
Q35: Fill in Blank C.
public
String
double
int
void
9.
Q36: Fill in Blank D.
public
String
double
int
void
10.
Q37: Fill in Blank E.
public
String
double
int
void
You have attempted
of
activities on this page.