1. Request the URL for a page of text on the Internet from the User. This is where you will search for text strings.
2. Load the page into memory. You may use any structure you find necessary, including search trees or hash tables, in order to search quickly and efficiently.
3. Ask the User to enter a string to find in the webpage you just loaded into memory.
4. Count the occurrences of the string on the page and print out that number. Otherwise, print out “String not found.” if there are zero occurrences of the search string.
5. Ask the User for another string to find on the page. If the User enters nothing but <Enter>, exit the program.
That’s it. One last requirement: DO NOT use any Java built-in search methods. You must write the search code from scratch. You may, however, use whatever classes that Java provides to build appropriate structures for an efficient search.
Don’t forget to comment your code. Be especially verbose when you explain your strategy for searching and if you build any structures to facilitate your search.
2. Load the page into memory. You may use any structure you find necessary, including search trees or hash tables, in order to search quickly and efficiently.
3. Ask the User to enter a string to find in the webpage you just loaded into memory.
4. Count the occurrences of the string on the page and print out that number. Otherwise, print out “String not found.” if there are zero occurrences of the search string.
5. Ask the User for another string to find on the page. If the User enters nothing but <Enter>, exit the program.
That’s it. One last requirement: DO NOT use any Java built-in search methods. You must write the search code from scratch. You may, however, use whatever classes that Java provides to build appropriate structures for an efficient search.
Don’t forget to comment your code. Be especially verbose when you explain your strategy for searching and if you build any structures to facilitate your search.