In this project, your task is to create a Java program that processes the provided "Hamlet" text file using regular expressions. The goal is to replace every occurrence of "Hamlet" with "Leon" and every occurrence of "Horatio" with "Tariq." This process should be achieved exclusively using the Pattern and Matcher classes, without relying on String Utilities for direct word replacement.
Begin by forking this repository and submit the URL of your fork via the Student Portal.
Start by writing test cases that will guide the development of your program. You are responsible for creating all the necessary tests to ensure the correctness and robustness of your solution. Some stubs for test cases have been provided, but you should expand upon these to cover various scenarios.
In this step, you will create methods to process the input text file using regular expressions. The main objective is to find and replace the target words "Hamlet" and "Horatio" with "Leon" and "Tariq," respectively. Ensure that your implementation uses the Pattern and Matcher classes to perform these replacements.
Develop methods to read the "Hamlet" text file and save the modified content back to a new file. Consider error handling and file I/O operations to make your program robust.
Execute the test cases you created in Step 2 to validate your solution. Ensure that the replacements are accurate, and the program handles different scenarios effectively.
Review your code for any potential optimizations or improvements. Consider factors such as code readability, performance, and maintainability.
Double-check your project to ensure it meets all the requirements and provides accurate text replacement.
Commit and push to your fork.