Due Date: Monday, September 25, 2023.
Please complete Lab 5 before completing the homework.
In this homework, you will need to test and debug a program that searches for a substring in a string and outputs a message telling us if the substring was found or not.
a. Download the following source file:
Substring.java
The program contains several syntax errors and a few conceptual errors. Create a project called hw5 and a package inside it called hw5. Add this class to the package.
b. Fix the compilation errors and run the program.
c. Test the program with multiple test cases, with some substrings that are in the string and some that are not. Test the program with one or both strings being empty. Add some output statements to guide you while debugging the program. If necessary, run it through the debugger.
Add a comment at the end of the program with all the test cases you found, and which of them worked from the beginning, which of them worked after you fixed the program, and which of them still don't work.
d. In the function isSubstring, add an assertion in the body of the first for loop at the top. Figure out a condition that should be true at that point in the program. Do the same with the second for loop.
Upload the files .java from the lab and Substring.java from the homework after you corrected and debugged them.