Add something to your HTML home page generator that will make random, relevant comments about the weather depending on the temperature.

If it’s going to be less than 32, you want to insert either “Watch out for ice!” or “Is it going to snow?”
If it’s going to be between 32 and 50, you want to insert either “I can’t wait for winter to be over!” or “Come on, Spring!”
If it’s over 50 but less than 80, you want to insert either “It’s getting warmer!” or “Light jacket weather.”
If it’s over 80, you want to insert either “FINALLY! Summer!” or “Time to go swimming!”


```
/? ?
? Method t o r e t u r n a random comment b a s e d on
? the passed temperature
?/
private S t r i n g getWeatherComment ( S t r i n g tempStr )
{
Random randNumGen = new Random ( ) ;
i n t randNum = randNumGen . n e x t I n t ( 2 ) ;
i n t temp = I n t e g e r . p a r s e I n t ( tempStr ) ;
i f ( temp < 3 2 )
{
i f ( randNum == 0 )
return ”Watch out f o r i c e ! ” ;
else
return ” I s i t g o i n g t o snow ? ” ;
}
e l s e i f ( temp <= 5 0 )
{
i f ( randNum == 0 )
return ” I can ’ t w a i t f o r w i n t e r t o be o v e r ! ” ;
else
return ”Come on , S p r i n g ! ” ;
}
e l s e i f ( temp < 8 0 )
{
i f ( randNum == 0 )
return ” I t ’ s g e t t i n g warmer ! ” ;
else
return ” L i g h t j a c k e t weather . ” ;
}
else
{
i f ( randNum == 0 )
return ”FINALLY ! Summer ! ” ;
else
return ”Time t o go swimming ! ” ;
}
}
/? ?
? 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 t h a t d i s p l a y s t h e c u r r e n t w e a t h e r
? @param name t h e p e r s o n ’ s name
? @param i n t e r e s t s a comma s e p e r a t e d l i s t o f
? the person ’ s i n t e r e s t s
?/
public void writeHomepageVW ( S t r i n g name ,
String i nt e r es t s )
{
// g e t t h e c u r r e n t t e m p e r a t u r e
TempFinder tempFinder = new TempFinder ( ) ;
S t r i n g u r l S t r i n g = ” h t t p : / /www. a j c . com/ ” ;
S t r i n g currTemp = tempFinder . getTempFromNetwork ( u r l S t r i n g ) ;
// 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” ) ;
// g e t a comment a b o u t t h e w e a t h e r
S t r i n g comment = getWeatherComment ( currTemp ) ;
// w r i t e t h e body
writeBody ( w r i t e r , ”

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 +
” .

Right now i t i s ” + currTemp +
” d e g r e e s . ” + comment + ”

” ) ;
// 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...

An employee of your company files a complaint with a security administrator. While sniffing network traffic, the employee discovers that financially confidential emails were passing between two warehouse users. The two users deny sending confidential emails to each other. You need to allow for non-repudiation and prevent network sniffers from reading the confidential mail. What should you do?

A. Implement transport encryption and authentication hashing. B. Implement transport encryption and legal mail hold. C. Implement legal mail hold and authentication hashing. D. Implement transport encryption and digital signatures.

Computer Science & Information Technology

Internet banking customers currently use an account number and password to access their online accounts. The bank wants to improve security on high value transfers by implementing a system which call users back on a mobile phone to authenticate the transaction with voice verification. Which of the following authentication factors are being used by the bank?

A. Something you know, something you do, and something you have B. Something you do, somewhere you are, and something you have C. Something you are, something you do and something you know D. Something you have, something you are, and something you know

Computer Science & Information Technology

?____ styles let you insert a style rule within an HTML tag in an HTML page.

A. ?Blocked B. ?Internal C. ?Inline D. ?Logged

Computer Science & Information Technology

The Contrast setting determines the Magnetic Lasso tool's sensitivity.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology