- Create A Formletter Class That Handles The Generation Of Mail Merge Form Letters Implement A Formletter Constructor Tha 1 (85.96 KiB) Viewed 28 times
Create a FormLetter class that handles the generation of mail merge form letters. Implement a FormLetter constructor tha
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am
Create a FormLetter class that handles the generation of mail merge form letters. Implement a FormLetter constructor tha
Create a FormLetter class that handles the generation of mail merge form letters. Implement a FormLetter constructor that contains a string parameter, formFilename. The parameter specifies the name of a file that contains a form letter. The constructor reads the form letter from the given file and loads its content into a formLetter array. Declare formLetter to be a 20-element array of strings. The formbetter data member should store each line from the file as a single array element. For example, the formLetter.txt file below should fill up the first 11 elements in your formbetter array. first 11e Implement a generateLetters method that contains a string parameter, insertionsFileName. The parameter specifies the name of a file that contains a list of insertions for the form letter. The method generates letters by inserting the insertions. into the form letter. Note the @'s in the insertions.txt file. They act as delimiters for the four insertions for each letter. The first insertion substitutes for all occurrences of @1 in the form letter; the second insertion substitutes for all occurrences of @2 in the form letter; and so on. Provide a visual cue for letter separation by printing a line of dashes above each letter. Study the input files below and the resulting output to make sure that you understand the insertion process. Use named constants when appropriate. Use private helper methods when appropriate. Since this is a relatively short program, put all code into one file. Your code should be written so that the following main method and form and insertion files produce the output shown in the sample session shown below: public static void main(String[] args) FormLetter letterl= new FormLetter ("formletter..txt"); Formbetter letter2 new FormLetter ("longLetter.txt"); Formbetter letter3 new FormLetter ("formLetter.txt"); letter3.generateletter ("insertions.txt"); ) // end main