Create a FormLetter class that handles the generation of mail merge form letters. Implement a FormLetter constructor tha

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
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

Post by answerhappygod »

Create A Formletter Class That Handles The Generation Of Mail Merge Form Letters Implement A Formletter Constructor Tha 1
Create A Formletter Class That Handles The Generation Of Mail Merge Form Letters Implement A Formletter Constructor Tha 1 (161.16 KiB) Viewed 31 times
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 formLetter 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 formLetter array. 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"); FormLetter letter2 = new FormLetter ("longLetter.txt"); FormLetter letter3 = new FormLetter ("formLetter.txt"); letter3.generateLetter ("insertions.txt"); } // end main
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply