Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Create a C++ program, using C++ only, please make the code simple and at where they needed.(Please follow the requirements). Your task is to create
Create a C++ program, using C++ only, please make the code simple and at where they needed.(Please follow the requirements).
Your task is to create the hated form letter. You will be reading in three lines of data for a potential customer, dividing some of the strings into substrings, formatting some, and then embedding these strings / substrings where they belong into the body of the letter shown below Overview 1. There are 3 lines of data to be entered per customer that will be read from the keyboard using getline(.) statements. An example is Mrs Weltz, Elaine 3307 3rd Ave. West Seattle, WA 981190241 2. You will then need to manipulate the strings so that various parts of them can be used to create a letter that looks like this Elaine Weltz 307 3rd Ave. Wes Seattle,_WA 98119-0241OutputLetterHeading() Dear Mrs. Weltz Spring is coming to Seattle and we at "Ice Cream of the Month" know that spring and summer are the best times for icy goodness. That is why we are offering all of our Washington friends a free 3-month trial membership in our club if you act NOW! ELAINE, this is the first time our newest flavor, Peachy Keen, will be sold in the 98119 area. Just imagine the Weltz family enjoying a tasty sundae with chocolate sauce and a cherryThe family will say, "EW, you are our hero!" We look forward to hearing from the WELTZ FAMILY soon. I. Alma Salsman OutputSignature() Ice Cream of the Month, State of Washington The underlined-and-colored words/letters are taken from the original 3 input strings. They are NOT expected to be underlined or colored - in the output. 3. To make it simpler for you, the following can be assumed Each run of the program will only generate a single letter, which is output to the screen. (Feel free to use a loop to create multiple letters in a run, but remember that this might combine getline() with cin >>, so you will have to handle that.) a. b. The user always enter valid data in the 3 lines, including 2-character state abbreviations. All the necessary "pieces" will be there (for example,Title LastName, FirstName for the first line and for the third line City, ST 999999999 That said, LastNames, FirstNames and Cities could contain multiple words. (For example, a city like Los Angeles.) The text for the letter (except for the added strings) may be hardcoded in your program for simplicity's sake. I tried to avoid "formatting" it too much so your letter should be able to look pretty much exactly like the sample c. Be careful to notice where we use full state names, uppercase, and full or formatted Zip codes (for example). THESE VARIATIONS on the original strings MUST BE CREATED PROGRAMMATICALLY! 4. The Functions: THESE are required. You may include ADDITIONAL functions if that helps you avoid writing duplicate code. For example, how many times do you want to write the code that figures out the state name? EnterUserData() You will need a function that gets three lines of data from the keyboard into three string reference parameters using getline(). If you do this correctly, all the function needs to have is the prompts and three getline() statements. (See Overview item 1) This is the ONLY input to the program (unless you want to do the optional loop from Overview 3a) Output LetterHead ing() A second function receives the 3 input lines as value parameters, then outputs the letter heading (see sample). Note how you will need to manipulate the strings...they aren't EXACTLY like the input lines. Output LetterBody() Outputs all of the letter except the heading and the signature. You only need to send it two of the original lines (so don't send all three) as value parameters. You will do a LOT of manipulating of the strings Key to working with the state: You will be entering two-char state abbreviations. To simplify "lookup" of states (since sometimes you need to output the abbreviation and sometimes the full state), note that Ice Cream of the Month only does business in Washington (WA), Oregon (OR), and California (CA) OutputSignature() function, only two of the original input lines are used as value parameters See the sample for the lines that are output by this function. As with the body TO HAND IN: 1) Your main.cpp source code 2) Screen shots of the letters generated by the following two sets of input (since l'll assume you can do the Weltz input for your own debugging...) Mrs Solo, Leia Organa 7603 Claremont Place Mount Vernon, WA 982737603 Mr Van Pelt, Linus 226 Peanuts Lane Petaluma, CA 949522524 Your task is to create the hated form letter. You will be reading in three lines of data for a potential customer, dividing some of the strings into substrings, formatting some, and then embedding these strings / substrings where they belong into the body of the letter shown below Overview 1. There are 3 lines of data to be entered per customer that will be read from the keyboard using getline(.) statements. An example is Mrs Weltz, Elaine 3307 3rd Ave. West Seattle, WA 981190241 2. You will then need to manipulate the strings so that various parts of them can be used to create a letter that looks like this Elaine Weltz 307 3rd Ave. Wes Seattle,_WA 98119-0241OutputLetterHeading() Dear Mrs. Weltz Spring is coming to Seattle and we at "Ice Cream of the Month" know that spring and summer are the best times for icy goodness. That is why we are offering all of our Washington friends a free 3-month trial membership in our club if you act NOW! ELAINE, this is the first time our newest flavor, Peachy Keen, will be sold in the 98119 area. Just imagine the Weltz family enjoying a tasty sundae with chocolate sauce and a cherryThe family will say, "EW, you are our hero!" We look forward to hearing from the WELTZ FAMILY soon. I. Alma Salsman OutputSignature() Ice Cream of the Month, State of Washington The underlined-and-colored words/letters are taken from the original 3 input strings. They are NOT expected to be underlined or colored - in the output. 3. To make it simpler for you, the following can be assumed Each run of the program will only generate a single letter, which is output to the screen. (Feel free to use a loop to create multiple letters in a run, but remember that this might combine getline() with cin >>, so you will have to handle that.) a. b. The user always enter valid data in the 3 lines, including 2-character state abbreviations. All the necessary "pieces" will be there (for example,Title LastName, FirstName for the first line and for the third line City, ST 999999999 That said, LastNames, FirstNames and Cities could contain multiple words. (For example, a city like Los Angeles.) The text for the letter (except for the added strings) may be hardcoded in your program for simplicity's sake. I tried to avoid "formatting" it too much so your letter should be able to look pretty much exactly like the sample c. Be careful to notice where we use full state names, uppercase, and full or formatted Zip codes (for example). THESE VARIATIONS on the original strings MUST BE CREATED PROGRAMMATICALLY! 4. The Functions: THESE are required. You may include ADDITIONAL functions if that helps you avoid writing duplicate code. For example, how many times do you want to write the code that figures out the state name? EnterUserData() You will need a function that gets three lines of data from the keyboard into three string reference parameters using getline(). If you do this correctly, all the function needs to have is the prompts and three getline() statements. (See Overview item 1) This is the ONLY input to the program (unless you want to do the optional loop from Overview 3a) Output LetterHead ing() A second function receives the 3 input lines as value parameters, then outputs the letter heading (see sample). Note how you will need to manipulate the strings...they aren't EXACTLY like the input lines. Output LetterBody() Outputs all of the letter except the heading and the signature. You only need to send it two of the original lines (so don't send all three) as value parameters. You will do a LOT of manipulating of the strings Key to working with the state: You will be entering two-char state abbreviations. To simplify "lookup" of states (since sometimes you need to output the abbreviation and sometimes the full state), note that Ice Cream of the Month only does business in Washington (WA), Oregon (OR), and California (CA) OutputSignature() function, only two of the original input lines are used as value parameters See the sample for the lines that are output by this function. As with the body TO HAND IN: 1) Your main.cpp source code 2) Screen shots of the letters generated by the following two sets of input (since l'll assume you can do the Weltz input for your own debugging...) Mrs Solo, Leia Organa 7603 Claremont Place Mount Vernon, WA 982737603 Mr Van Pelt, Linus 226 Peanuts Lane Petaluma, CA 949522524Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started