Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Using Java: How to Implement? Create a new class named URLWrapper with the following: 1 . Two private data members: final URL url and int
Using Java:
How to Implement?
Create a new class named URLWrapper with the following:
Two private data members: final URL url and int count.
Constructor: creates URL object with a parameter and assign it to the private member url.
Getter methods for private data members:
protected URL getURL
protected int getCount
The findCount method finds the number of occurrences of the userspecified search keyword in the HTML file.
Set up buffered reader.
Read from URL and count the number of occurrences of keyword.
protected void findCountString key
The extractInnerURL method gets inner URLs.
For the inner links, may use the regular expression: "hrefhttphttps:
protected ArrayList extractInnerURLSString key
Procedures:
Get input from the user: base URL and search keyword from the console.
Get the total occurrence of search keyword for base URL.
Get inner URLs.
Get the total occurrence of search keyword for each inner URL.
Sort the inner URLs in descending order by count.
Print result to screen and write to file.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started