Exercise 7.3 A WebPage consists of a
String header,
and a Body b.
A Body is a list of HTML elements.
A
HTML element is either
a String word
or a Link.
A Link consists of
a String word
and a WebPage.
Perform the following tasks:
Draw the UML diagram for the collection of classes that represent web pages.
Develop the classes.
Develop the method allWords, which produces a list of all words in the web page
Develop the method pages, which produces the list of immediate words on a page. That is, it consumes a WebPage and produces a list of String. An immediate word on a list of HTML elements is defined as follows:
an HTML element that is a word is the immediate word
for an HTML element that is a Link, the method extracts the word from the Link.
Develop the method occurs, which determines whether the given word occurs in the web page or its embedded pages.