[Solved]Char Emailaddresses 251i5 Matloff Yahooca Marta Allison E0 Aleurohackgyahoocom Jake Guzman Q37232139






char emailAddresses[251I5″A matloff@yahoo.ca Marta Allisone0, “Aleurohackgyahoo.com Jake Guzmanle”, “Alcgreutergverizon.net| Colin Bridgeso”, “Aljramio@yahoo.com Jody Owenle”, A|kwilliams@gmail.com Vera Connerie”, “Algknauss@gmail.com Bernard Stonee”, A sakusha@verizon.net Josh Tranle”, Al smpeters@outlook.com Krista Lewisle”, “Alpgottsch yahoo.ca Andres Sanchezve, “Al lahvak@comcast.net Wanda Wilkersonve”, “A seasweb@comcast.net Sheldon Hamptone”, Al fwitnessgatt.net Aubrey Morganle”, “Alprivcanlive.com Dan Abbottl0, “Al isorashigatt.net Beatrice Maxwellle”, “A maneesh@yahoo.com Leonard Butlerle”, “Almrdvtme.com Gina Norrisle”, “Alkassiesa@aol.com Pedro Petersone”, “Aijackson@sbcglobal.net Andy Mclaughline”, “Algoldberggyahoo.com Jodi Munoze”, “Alsalesgeek@comcast.net Francis Woods1e”, “A ehood@me.com Jennifer Bryantla” “A1staf@verizon.net Delores Mendozale”, “Alsekiyagme.coml immy Kellyle”, “A dalamb@verizon.netAbel Harmonle”, “A amichalo@yahoo.ca Wilson Robertsonlo”; char *messages[5] { “pFron: “FFrom: “LFrom: “BFron: Efron: Processing CenternTo: %snSubject: Your PhotosnnHello %s,nYour photos are ready to pickup.nnThank You.nProces sing Teame”, Wilma TheaternTo: %snSubject: Fiesta CelebrationnnDear %s,nJust a reminder that the Fiesta Party is this weekend at the Theater.nnThank YounOrganizerse”, Betty NugeranTo: %snSubject: Pot Luck tonightnnHey %s,nGuys, so as planned we are meeting at Betty’s at 7:00 this evening. nnThanksnDavide”, City HospitalnTo: %snSubject: Past Due BillnnDear %s,nThere is a past due bill payment. Please contact city hospital.nnThank YounCity Hospital Billing Center”, UTSSA EnrollmentsnTo: %snSubject : UTSSA Enrollments,nnHello %s,nUTSSA Fall enrollments June 01.nnThank YounUTSSA Enrollments Center “); starts In this assignment you will mock an old fashion mass email system with several many restrictions. Follow these steps 1. a. Start a new.c/cpp file. At global level, define the two string arrays (emailaddresses and messages) given to you (emailsandmessages.txt) b. define the following structure at global level struct Credentials f char userEmail [25]; char userFullName [30] char emailMsg[220] 2. Next, a. In the main ( open a file in binary append mode to write structure Credential instances b. Then ask the user to enter number of emails to be sent (see example in figure 1) and then store it. If the user entered a number not within the asking range, show an error message and ask to reenter /assignment08. exe nter Number of Emails to be sent (Enter a number between 1 and 5) Figure 1 3. Next ask for the type of email to be sent. See the example below (Figure 2). Let the user enter the choice Again, if the user entered an option other than (P, F, L, B, E) then show an error and ask for the option Select Email Type to send P Photo Processing Figure 2 – Fiesta Celebration L Pot Luck Party Tonight B Past due hospital bill E UTSSA Enrol1ments Enter Option 4. If you look at the messages array given to you, the first character in each message matches the menu’s option character. For example following Is one item from messages array. See the first character ‘F matches with the menu’s ‘Fiesta Celebration’ message “FFrom : Wilma TheaternTo: %snSubject: Fiesta CelebrationnnDear %s,nJust a reminder that the Fiesta Party is this weekend at the Theater. InnThank YounOrganizerse'” Idea is to extract the message to be sent based on the selection made from the menu. 5. Next, iterate a loop to the number of messages entered in step 2, and do the following WITHIN THE loop a. Generate a random number between 0 and 24 (both inclusive). Google for the rand) function. There are plenty of examples out there b. Extract the email and name record from the emailaddress array at the position of the random number you created. For example, say in the first iteration, the random number you created was 11. So just access the 11th location in the emailmessages array, which is “Alfwitness@att.net Aubrey Morganlo”, c. Use C programing language’s string tokenizer function (strtok () to tokenize the above string and extract out each element. d. Next using dynamic memory allocation, allocate memory for an instance of the struct Credentials. Then copy the email address and the name tokened in step 5c, to the userEmail and userName components of the allocated Credentials object. e. Now, you are going to ‘send’ (really print) the email selected in step 4, to the email address In our mock email sending program, ‘send’ means really just print it on the screen and save it in a binary file. But before that, you must fill the %s locations in the email string with the recipient mail and the salutation with the selected receipient’s name. For example, the receipient’s information in the current iteration is “Alfwitness@att.net Aubrey Morgan 0″ Email selected is: ‘ F From: Wilma TheaternTo: %snSubject: Fiesta CelebrationnnDear %s,nJust a reminder that the Fiesta Party is this weekend at the Theater.nThank Younorganizers1e” Make sure you drop the first character p. Then use the sprint() function to replace first %s with fwitness@att.net and the second %s with fwitness@att.net, so after filling the formatters %s, the string will now print From: Wilma Theater To: Subject: Fiesta Celebration ne ne Dear Aubrey Morgan, Just a reminder that the Fiesta Party is this weekend at the Theater. Thank You Organizers f. Print the above message (the formatted one) to the console. g. Now copy the formatted email to the emailMsg component of the allocated Credentials object (you created in step 5d) to the file you created in step 1a i. Suspend the loop for one second. Continue the loop to the next iteration. 6. So after the step 5i, you have ‘sent’ (really printed) email selected in step 3 to the email addresses user input in step 2. 7. Important: When random numbers generated, there is confident possibility that the number(s) generated could be repeated. So in your loop in step 5, make sure to put a X’ (meaning already used the email address)overwriting the ‘A’ (available) in each record’s first character after they are used. In your logic, when an email address record is picked randomly, send the email ONLY IF the first character is ‘A Otherwise, ignore that record (do not send the email. That’s OK if you skip records). B. After every teration rth dat t th ile) MAKE SURE to relese the allcated memory 9. After all emails are ‘sent’, close the file. 10. Print the File’s size using file stat record. Here is a screen dump of a full simulation. User enters number of emails to send s/assignment08. exe Enter Number of Emails to be sent (Enter a number between 1 and 5):2 Entered of emails to send 2 Select Email Type to send User enters email type to be sent P Photo Processing F -Fiesta Celebration L Pot Luck Party Tonight B Past due hospital bill E UTSSA Enrollment Enter Option: F now sending From: Wilma Theater To: 1ahvak@comcast. net Subject: Fiesta Celebration Dear Wanda Wilkerson, ust a reminder that the Fiesta Party is this weekend at the Theater Thank You Organizers Email selected nt to 2 people now sending…. From: Wilma Theater To: kwil1iamsegmail.com Subject: Fiesta Celebration Every email is written to the file along with the user’s name and email address. Dump the file size after sending user requested Dear Vera Conner, ust a reminder that the Fiesta Party is this weekend at the Theater. Thank You rganizers urrent size of file./emails.bin2200 bytes Show transcribed image text char emailAddresses[251I5″A matloff@yahoo.ca Marta Allisone0, “Aleurohackgyahoo.com Jake Guzmanle”, “Alcgreutergverizon.net| Colin Bridgeso”, “Aljramio@yahoo.com Jody Owenle”, A|kwilliams@gmail.com Vera Connerie”, “Algknauss@gmail.com Bernard Stonee”, A sakusha@verizon.net Josh Tranle”, Al smpeters@outlook.com Krista Lewisle”, “Alpgottsch yahoo.ca Andres Sanchezve, “Al lahvak@comcast.net Wanda Wilkersonve”, “A seasweb@comcast.net Sheldon Hamptone”, Al fwitnessgatt.net Aubrey Morganle”, “Alprivcanlive.com Dan Abbottl0, “Al isorashigatt.net Beatrice Maxwellle”, “A maneesh@yahoo.com Leonard Butlerle”, “Almrdvtme.com Gina Norrisle”, “Alkassiesa@aol.com Pedro Petersone”, “Aijackson@sbcglobal.net Andy Mclaughline”, “Algoldberggyahoo.com Jodi Munoze”, “Alsalesgeek@comcast.net Francis Woods1e”, “A ehood@me.com Jennifer Bryantla” “A1staf@verizon.net Delores Mendozale”, “Alsekiyagme.coml immy Kellyle”, “A dalamb@verizon.netAbel Harmonle”, “A amichalo@yahoo.ca Wilson Robertsonlo”; char *messages[5] { “pFron: “FFrom: “LFrom: “BFron: Efron: Processing CenternTo: %snSubject: Your PhotosnnHello %s,nYour photos are ready to pickup.nnThank You.nProces sing Teame”, Wilma TheaternTo: %snSubject: Fiesta CelebrationnnDear %s,nJust a reminder that the Fiesta Party is this weekend at the Theater.nnThank YounOrganizerse”, Betty NugeranTo: %snSubject: Pot Luck tonightnnHey %s,nGuys, so as planned we are meeting at Betty’s at 7:00 this evening. nnThanksnDavide”, City HospitalnTo: %snSubject: Past Due BillnnDear %s,nThere is a past due bill payment. Please contact city hospital.nnThank YounCity Hospital Billing Center”, UTSSA EnrollmentsnTo: %snSubject : UTSSA Enrollments,nnHello %s,nUTSSA Fall enrollments June 01.nnThank YounUTSSA Enrollments Center “); starts
In this assignment you will mock an old fashion mass email system with several many restrictions. Follow these steps 1. a. Start a new.c/cpp file. At global level, define the two string arrays (emailaddresses and messages) given to you (emailsandmessages.txt) b. define the following structure at global level struct Credentials f char userEmail [25]; char userFullName [30] char emailMsg[220] 2. Next, a. In the main ( open a file in binary append mode to write structure Credential instances b. Then ask the user to enter number of emails to be sent (see example in figure 1) and then store it. If the user entered a number not within the asking range, show an error message and ask to reenter /assignment08. exe nter Number of Emails to be sent (Enter a number between 1 and 5) Figure 1 3. Next ask for the type of email to be sent. See the example below (Figure 2). Let the user enter the choice Again, if the user entered an option other than (P, F, L, B, E) then show an error and ask for the option Select Email Type to send P Photo Processing Figure 2 – Fiesta Celebration L Pot Luck Party Tonight B Past due hospital bill E UTSSA Enrol1ments Enter Option 4. If you look at the messages array given to you, the first character in each message matches the menu’s option character. For example following Is one item from messages array. See the first character ‘F matches with the menu’s ‘Fiesta Celebration’ message “FFrom : Wilma TheaternTo: %snSubject: Fiesta CelebrationnnDear %s,nJust a reminder that the Fiesta Party is this weekend at the Theater. InnThank YounOrganizerse'” Idea is to extract the message to be sent based on the selection made from the menu.
5. Next, iterate a loop to the number of messages entered in step 2, and do the following WITHIN THE loop a. Generate a random number between 0 and 24 (both inclusive). Google for the rand) function. There are plenty of examples out there b. Extract the email and name record from the emailaddress array at the position of the random number you created. For example, say in the first iteration, the random number you created was 11. So just access the 11th location in the emailmessages array, which is “Alfwitness@att.net Aubrey Morganlo”, c. Use C programing language’s string tokenizer function (strtok () to tokenize the above string and extract out each element. d. Next using dynamic memory allocation, allocate memory for an instance of the struct Credentials. Then copy the email address and the name tokened in step 5c, to the userEmail and userName components of the allocated Credentials object. e. Now, you are going to ‘send’ (really print) the email selected in step 4, to the email address In our mock email sending program, ‘send’ means really just print it on the screen and save it in a binary file. But before that, you must fill the %s locations in the email string with the recipient mail and the salutation with the selected receipient’s name. For example, the receipient’s information in the current iteration is “Alfwitness@att.net Aubrey Morgan 0″ Email selected is: ‘ F From: Wilma TheaternTo: %snSubject: Fiesta CelebrationnnDear %s,nJust a reminder that the Fiesta Party is this weekend at the Theater.nThank Younorganizers1e” Make sure you drop the first character p. Then use the sprint() function to replace first %s with fwitness@att.net and the second %s with fwitness@att.net, so after filling the formatters %s, the string will now print From: Wilma Theater To: Subject: Fiesta Celebration ne ne Dear Aubrey Morgan, Just a reminder that the Fiesta Party is this weekend at the Theater. Thank You Organizers
f. Print the above message (the formatted one) to the console. g. Now copy the formatted email to the emailMsg component of the allocated Credentials object (you created in step 5d) to the file you created in step 1a i. Suspend the loop for one second. Continue the loop to the next iteration. 6. So after the step 5i, you have ‘sent’ (really printed) email selected in step 3 to the email addresses user input in step 2.
7. Important: When random numbers generated, there is confident possibility that the number(s) generated could be repeated. So in your loop in step 5, make sure to put a X’ (meaning already used the email address)overwriting the ‘A’ (available) in each record’s first character after they are used. In your logic, when an email address record is picked randomly, send the email ONLY IF the first character is ‘A Otherwise, ignore that record (do not send the email. That’s OK if you skip records). B. After every teration rth dat t th ile) MAKE SURE to relese the allcated memory
9. After all emails are ‘sent’, close the file. 10. Print the File’s size using file stat record. Here is a screen dump of a full simulation. User enters number of emails to send s/assignment08. exe Enter Number of Emails to be sent (Enter a number between 1 and 5):2 Entered of emails to send 2 Select Email Type to send User enters email type to be sent P Photo Processing F -Fiesta Celebration L Pot Luck Party Tonight B Past due hospital bill E UTSSA Enrollment Enter Option: F now sending From: Wilma Theater To: 1ahvak@comcast. net Subject: Fiesta Celebration Dear Wanda Wilkerson, ust a reminder that the Fiesta Party is this weekend at the Theater Thank You Organizers Email selected nt to 2 people now sending…. From: Wilma Theater To: kwil1iamsegmail.com Subject: Fiesta Celebration Every email is written to the file along with the user’s name and email address. Dump the file size after sending user requested Dear Vera Conner, ust a reminder that the Fiesta Party is this weekend at the Theater. Thank You rganizers urrent size of file./emails.bin2200 bytes
Expert Answer
Answer to char emailAddresses[251I5″A matloff@yahoo.ca Marta Allisone0, “Aleurohackgyahoo.com Jake Guzmanle”, “Alcgreutergverizon… . . .
OR

