After 75 minutes, no submissions will be accepted
26 points
20 points
addLine("I am")
at the end of this class. (It's the last method—ignore the methods before it.) Be sure to trace through the loop inside the method. Do NOT trace into addWord
.
Make a column for each local variable. Write new values below to the old ones when they change. Put an X when a local variable is removed. Make a separate line for each modification.
Submit a file problem3.txt
completing this form:
words i more ch j ------------------------------- I am
20 points
Using the BlueJ debugger, set a breakpoint on the first line inside the addWord
method of Mystery.java.
Run the program until it reaches the breakpoint.
a) What is the value of word
?
Now set a breakpoint in the first line of the spread
method. Run the program until it reaches that breakpoint. Don't clear the other one.
b) How many more times was the first breakpoint triggered before the second one was reached?
c) Step through the spread
method. How many times do you go inside
if (i < current.length()) // How many times?
d) Keep stepping until you reach the end of the for
loop. Now enter the eol
method. Which button did you use?
e) What are the values of the instance variables when you reach the last line of the eol
method?
f) Take a screen capture of the debugger window with the instance variables when you are at the last line of eol
i.e.
words = 0; // Take screen capture here
Submit a file problem4.txt and a file problem4.png containing your screen capture.
12 points