Skip to main content
Contents
Dark Mode Prev Up Next Scratch ActiveCode Profile
\(
\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.2 Write Method Headers-WE1-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.2.1
For questions 1 through 3, fill in the blanks of the following code, which is a public method header for the method
politics that returns a String and doesnβt accept any parameters.
_______ _______ politics (_______) { /* logic */ }
A B C
Exercises Exercises
1.
public
Correct
private
Incorrect
String
Incorrect
void
Incorrect
nothing, empty
Incorrect
2.
public
Incorrect
String
Correct
double
Incorrect
void
Incorrect
nothing, empty
Incorrect
3.
public
Incorrect
private
Incorrect
String
Incorrect
void
Incorrect
nothing, empty
Correct
For questions 4 through 8, fill in the blanks of the following code. Write the method header for a public method that returns an integer and requires the following parameters: one integer, one double, and one String (in that order).
_______ _______ backpain (_______ one, _______ two, _______ three)
A B C D E
{
/* logic */
}
4.
public
Correct
private
Incorrect
String
Incorrect
int
Incorrect
double
Incorrect
5.
public
Incorrect
private
Incorrect
String
Incorrect
int
Correct
double
Incorrect
6.
String
Incorrect
int
Correct
double
Incorrect
void
Incorrect
nothing, empty
Incorrect
7.
String
Incorrect
int
Incorrect
double
Correct
void
Incorrect
nothing, empty
Incorrect
8.
String
Correct
int
Incorrect
double
Incorrect
void
Incorrect
nothing, empty
Incorrect
For questions 9 through 12, fill in the blanks of the following code, which is a private method header that returns a String and requires as parameters a double and a String (in that order).
_______ _______ leonardo (_______ one, _______ two) { /* logic */ }
A B C D
9.
public
Incorrect
private
Correct
String
Incorrect
int
Incorrect
double
Incorrect
10.
public
Incorrect
private
Incorrect
String
Correct
int
Incorrect
double
Incorrect
11.
String
Incorrect
int
Incorrect
double
Correct
void
Incorrect
nothing, empty
Incorrect
12.
String
Correct
int
Incorrect
double
Incorrect
void
Incorrect
nothing, empty
Incorrect
You have attempted
of
activities on this page.