Class MyListAccessor
This homework is intended to give you hands-on experience debugging and testing code. The intent is to give you more practice with linked lists and develop your intuition about how linked lists work.
Instructions:
1. Make sure you have watched last week's lecture. Read over the main method and the test methods to develop an understanding of what they are doing.
2. Look for the TODO in the code below.
3. Utilize the techniques presented (your choice of Inspection, print statements, trace on paper, Trace utility, or IntelliJ Interactive debugger) to find and fix the bugs.
This is a "written homework" assignment. You do NOT need to submit this file with solutions as part of this homework. You DO need to submit your answers to the questions posed below.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
static int
numFives
(MyListAccessor list) TODO: Change this to invoke each method, numFives1, numFives2, ...int
int
int
int
int
int
int
int
int
int
toString()
-
Constructor Details
-
MyListAccessor
public MyListAccessor()
-
-
Method Details
-
numFives1
-
numFives2
-
numFives3
-
numFives4
-
numFives5
-
numFives6
-
numFives7
-
numFives8
-
numFives9
-
numFives10
-
numFives
TODO: Change this to invoke each method, numFives1, numFives2, ... numFives10, in turn. You can comment out the first line and uncomment the second line.For each version of the method, tell me:
a. Whether there is a bug or not. (Note: There are no compiler errors in this file). b. What's wrong with the method and how to fix it.
Fix the code for each method to make it work. Some of the implementations may end up looking the same, or very similar.
Write your answers the the questions about each implementation of numFives on paper, or put them in a Word document. Upload a scan of your handwritten answers or your Word document to D2L. Do not submit image files directly, although you can paste photographs of your handwritten answers into the Word document. A better alternative would be to use a scanning app on your phone, and submit a PDF of your handwritten answers.
You do not need to hand in this file.
-
main
-
toString
-