In this lab, you will become familiar with debuggers.
Working individually, you will debug a program that prints a calendar of the first 3 months of a
year to the screen.
While the defects in the programs of this lab may not be complicated, use the time to become
familiar with how your debugger works before you are faced with complex code.
Do not resort to debugging in this lab using print statements.
• Review the chapter on debugging from “Code Complete”, posted to the course web
• Download the code for calendar.java from the course’s web page lab 2 “assignment”.
• Download the code for the linked list implementation from the course’s web page lab 2
• The debugger in your IDE.
1. Create a project in your IDE for the calendar program and get the calendar program
2. Create a project in your IDE for the linked list program and get LinkedListTest.java to run.
1. Run the calendar program on one or more years. Use years where you can get a reference
calendar for those years.
2. Examine the output and determine the signs of incorrect output. These signs represent
defects in the program.
3. Set a breakpoint at the start of the calendar program.
4. Select a defect in your program.
5. Run your program in the debugger and step through the program to identify where the
defect happens in the code.
6. Conclude what could fix the defect.
7. If possible, based on the nature of the defect, use the debugger to change variable values to
verify if your conclusion is correct.
8. Make a change to the program and re-test it to ensure that the defect that you selected is
9. Return to step 4 for a next defect until all defects are fixed.
10. Familiarize yourself with the LinkedListTest.java program and what the output should be.
11. Run the program and note the differences in expected output.
12. As in Part 1, use the debugger to locate and fix the defects in the program.
What strategy or strategies for debugging are most effective for you?
What makes them effective?
For which conditions of the code will your strategies be effective of ineffective?
How can a debugger support your strategies?
1. In one file, list
o The cause of the defects that you found.
o The approach that let you locate the defect.
o The approximate amount of time it took you to locate the defect.
o The answers from the questions in the Analysis section of the lab.
2. Generate a PDF from the document.
3. Submit the PDF and your Java files in Brightspace in the Lab/Lab 2 section of the course web
page by Friday, September 24, 2021 11:59pm (Halifax time).
The assessment will be on a letter grade and will reflect how well you are demonstrating that
you are using and understanding debugging strategies and support tools like the debugger. I
am more concerned with your familiarity with the debugging process than on finding and fixing
every bug in the lab code.