Source code to test debugging
First, Fork this project.
There are three exercises splitted in three branches of this repository. You must switch branches to checkout the code of each exercise. Then, find the bugs that appear in each branch. Fix the bugs if you can and answer to the questions proposed below. Commit the code before checking out a different branch to avoid loosing the fixes that you have made to the code.
Once that you are done fixing bugs, to score you must:
- Switch to the master branch.
- Type below in this README.md file the answer to each question and paste some code that you have used to solve them.
- Commit the changes
- Push to your GitHub repository
- Finally place a Pull Request so I can see your proposed answers
In this code there is a class called WordAnalyzer that contains several methods that analyzes some characteristics of the word passed as argument when the object WordAnalyzer is created.
For some reason, the methods are not working properly, sometimes they return the correct value and others don't. You need to answer the next questions.
Why the method firstMultipleCharacter is returning "c" for the word comprehensive, when the correct answer should be "e"?
Strategy: Place breakpoints before the methods are executed, step into them and see what happens.
In this code we are placing mines in a board game where we have several spaces that can be mined. The boards can contain Element objects, and since Space and Mine inherits from Element, the boards can contain this kind as well.
We have two boards of different size and place a different number of mines on each one. But in the second case it takes longer to place all the mines.
Knowing that usually there are going to be more bombs than spaces in the final boards, how would you change the method minningTheBoard to be more efficient?
Strategy: Understand well what the code does. Use conditionals breakpoints.
In this case this code looks really simple. When the "d" reaches the value 1.0, the program should end, but it never does.