Extend the form letter recipe to take an input of a pet’s name and type, and reference the pet in the form letter. "Your pet "+petType+","+petName+" will love our offer!" might generate "Your pet poodle, Fifi, will love our offer!". See the FormLetterGenerator class in the directory bookClassesFinal.

What will be an ideal response?


```
/? ?
? Method t o g e n e r a t e a form l e t t e r
? @param t i t l e t h e p e r s o n ’ s t i t l e (Mr . , Mrs . , Dr . )
? @param lastName t h e l a s t name f o r t h e r e c i p i e n t
? @param c i t y t h e name o f t h e c i t y f o r t h e r e c i p i e n t
? @param e y e C o l o r t h e e y e c o l o r o f t h e r e c i p i e n t
? @param petName t h e name o f t h e p e t
? @param petType t h e t y p e o f animal ( c a t , dog , e t c )
?/
public void w r i t e L e t t e r ( S t r i n g t i t l e , S t r i n g lastName ,
S t r i n g city , S t r i n g eyeColor ,
S t r i n g petName , S t r i n g petType )
{
S t r i n g f i l e N a m e = lastName + ” L e t t e r . t x t ” ;
// t r y t o open t h e f i l e and w r i t e t o i t
try {
// c r e a t e t h e b u f f e r e d w r i t e r t o u s e t o w r i t e t h e f i l e
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 ( f i l e N a m e ) ) ;
// w r i t e t h e b e g i n n i n g
w r i t e B e g i n n i n g ( w r i t e r , t i t l e , lastName ) ;
// w r i t e t h e body o f t h e l e t t e r
writeBody ( w r i t e r , c i t y , e y e C o l o r , petName , petType ) ;
// w r i t e t h e e n d i n g
writeEnding ( w r i t e r ) ;
// c l o s e t h e f i l e
writer . close ( ) ;
} catch ( E x c e p t i o n ex ) {
System . out . p r i n t l n ( ” E r r o r w r i t i n g t o ” + f i l e N a m e ) ;
}
}
```

Computer Science & Information Technology

You might also like to view...

Which of the following should be the first profile you create or acquire in color management?

A. monitor profile B. printer profile C. scanner profile

Computer Science & Information Technology

When you ________ words at the end of a line, you can usually increase the number of words that fit on each line

Fill in the blank(s) with correct word

Computer Science & Information Technology

?Retention periods of backups can be a specific number of months or years, depending on legal requirements and company policy.

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

Computer Science & Information Technology

32 What Windows command can be used to copy entire directories, including subdirectories?

A. xcompact B. xcomp C. xcmd D. xcopy

Computer Science & Information Technology