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
-
-
Determine types of logic (expression, selection, loop, etc.)
-
Define internal variables
-
Subsection 9.4.1
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.
public
Correct
private
Incorrect
String
Incorrect
void
Incorrect
nothing, empty
Incorrect
2.
public
Incorrect
String
Correct
double
Incorrect
int
Incorrect
void
Incorrect
3.
public
Incorrect
String
Incorrect
double
Correct
int
Incorrect
void
Incorrect
4.
public
Incorrect
String
Incorrect
double
Correct
int
Incorrect
void
Incorrect
5.
public
Incorrect
String
Incorrect
double
Incorrect
int
Correct
void
Incorrect
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.
public
Incorrect
private
Correct
String
Incorrect
void
Incorrect
nothing, empty
Incorrect
7.
public
Incorrect
String
Incorrect
double
Incorrect
int
Incorrect
void
Correct
8.
public
Incorrect
String
Incorrect
double
Incorrect
int
Correct
void
Incorrect
9.
public
Incorrect
String
Incorrect
double
Incorrect
int
Correct
void
Incorrect
10.
public
Incorrect
String
Incorrect
double
Incorrect
int
Correct
void
Incorrect
You have attempted
of
activities on this page.