Question: 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
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
