Create a method writeNewsPage in the class WebPageWriter that will create a page of the information you find important from at least 3 websites. See the Headline Grabber class and method writeHomepageV8 in the WebPageWriter class in the directory bookClassesFinal.

What will be an ideal response?

```
/? ?
? Method f o r w r i t i n g a homepage f o r t h e p a s s e d
? name w i t h t h e t o p 3 h e a d l i n e s from cnn , time , and p e o p l e
? @param name t h e p e r s o n ’ s name
? @param i n t e r e s t s a l i s t o f t h e p e r s o n ’ s i n t e r e s t s
?/
public void writeHomepageV8 ( S t r i n g name , S t r i n g i n t e r e s t s )
{
// t r y t h e f o l l o w i n g
try {
// open a f i l e f o r w r i t i n g
S t r i n g path = F i l e C h o o s e r . getMediaPath ( name + ” . html ” ) ;
BufferedWriter writer =
new B u f f e r e d W r i t e r (new F i l e W r i t e r ( path ) ) ;
// w r i t e t h e s t a r t
writeStart ( writer );
// w r i t e t h e h e a d e r
writeHead ( w r i t e r , name + ” ’ s Homepage” ) ;
// add t h e h e a d l i n e s
H e a d l i n e G r a b b e r g r a b b e r = new H e a d l in e G r a b b e r ( ) ;
S t r i n g body = ”

Welcome t o ” + name +
” ’ s Homepage

” +

I am i n t e r e s t e d i n ” + i n t e r e s t s ;
body = body + ”

The Top H e a d l i n e s from CNN, Time , and People

”+
g r a b b e r . getCNNHeadline ( ) + ”

” + g r a b b e r . g e t T i m e H e a d l i n e ( ) + ”

” +
grabber . getPeopleHeadline ( ) ;
// w r i t e t h e body
writeBody ( w r i t e r , body ) ;
// end t h e page
writeEnd ( w r i t e r ) ;
// c l o s e t h e w r i t e r
writer . close ( ) ;
} catch ( E x c e p t i o n ex ) {
ex . p r i n t S t a c k T r a c e ( ) ;
}
}
```

Computer Science & Information Technology

You might also like to view...

A slide show created in PowerPoint 2013 can NOT be saved in an earlier version of PowerPoint

Indicate whether the statement is true or false

Computer Science & Information Technology

AI is NOT concerned with _______________.

A. building computers and robots with intelligence B. studying the thought processes of humans C. recreating the thought processes of humans via machines D. replacing workers with machines to reduce costs

Computer Science & Information Technology