Download the following Java program: DebugExample
Compile the program and fix the many syntactic (i.e., runtime) errors.
The DebugExample program simulates user input by calling Math.random(). It is then suppose to increment the input by 5, using a for-loop -- admittedly not the best approach. However, the program contains 2 semantic (i.e., logic) errors. Identify and correct these errors.
One challenge is that the simulated input is unknown to you. Examine the code. How can you learn the value of "user input"? Hint: How do you learn the value of the result?
Once you know the user input, compare the expected output to the output generated. What are the 2 logic errors? Hint: Look at the for-loop.