Skip to main content Contents
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 8.6 Write-Methods-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
Subsection 8.6.1
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:
___A___ ___B___ robertsDay (___C___ one, ___D___ two, ___E___ three)
{
/* logic */
}
Exercises Exercises
1.
Q33: Fill in Blank A.
public
private
String
void
nothing, empty
2.
Q34: Fill in Blank B.
public
String
double
int
void
3.
Q35: Fill in Blank C.
public
String
double
int
void
4.
Q36: Fill in Blank D.
public
String
double
int
void
5.
Q37: Fill in Blank E.
public
String
double
int
void
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 */ }
6.
Q38: Fill in Blank A.
public
private
String
int
double
7.
Q39: Fill in Blank B.
public
private
String
int
double
8.
Q40: Fill in Blank C.
String
int
double
void
nothing, empty
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 */
}
9.
Q41: Fill in Blank A.
public
private
String
void
nothing, empty
10.
Q42: Fill in Blank B.
public
String
double
int
void
11.
Q43: Fill in Blank C.
public
String
double
int
void
12.
Q44: Fill in Blank D.
public
String
double
int
void
13.
Q45: Fill in Blank E.
public
String
double
int
void
You have attempted
of
activities on this page.