Question

Java Email Template Application: Create an application that creates a series of emails as outlined below....

Java Email Template Application:

Create an application that creates a series of emails as outlined below.

Create an array of email addresses that include the following data:

"   james   ,butler,jbutler@hotmail.com"

"Josephine,Darakjy,Josephine_Darakjy@darakjy.org"

"ART,VENERE,ART@VENERE.ORG"

Store a template for a mass email like this:

String template =

    "To:      {email}\n" +

    "From:    noreply@deals.com\n" +

    "Subject: Deals!\n\n" +

    "Hi {first_name},\n\n" +

    "We've got some great deals for you. Check our website!";

When the application starts, it should read the email addresses and first names, merge them into the mass email template, and display the results on the console.

All email addresses should be converted to lowercase.

All first names should be converted to title case.

Test your application by adding names/emails to the list of email addresses without modifying any other code, the application should create more emails.

Test your application by modifying the template without modifying any other code, the application should change the content of the email that’s created.

Application output should look like this

Console

Emails

================================================================

To:      jbutler@hotmail.com

From:    noreply@deals.com

Subject: Deals!

Hi James,

We've got some great deals for you. Check our website!

================================================================

To:      josephine_darakjy@darakjy.org

From:    noreply@deals.com

Subject: Deals!

Hi Josephine,

We've got some great deals for you. Check our website!

================================================================

To:      art@venere.org

From:    noreply@deals.com

Subject: Deals!

Hi Art,

We've got some great deals for you. Check our website!

End

0 0
Add a comment Improve this question Transcribed image text
Answer #1

public class Email {

public static void main(String[] args) {

String emailArray[]={" james ,butler,jbutler@hotmail.com","Josephine,Darakjy,Josephine_Darakjy@darakjy.org","ART,VENERE,ART@VENERE.ORG"};

String template =

"To: {email}\n" +

"From: noreply@deals.com\n" +

"Subject: Deals!\n\n" +

"Hi {first_name},\n\n" +

"We've got some great deals for you. Check our website!";

System.out.println("Emails");

for(int i=0;i<emailArray.length;i++){

//my logic

//1.splitting the string which contain fristname , last name , email address

String temp[]=emailArray[i].split(",");

//taking the first name and trim the white spaces back and front of the string

String firstName=temp[0].trim();

//i want to change it to title case so taking first character and

//changing it to upper case then adding string from index 1

String modifiedFirstName=(firstName.charAt(0)+"").toUpperCase()+firstName.substring(1);

//taking email

String email=temp[2].trim();

//i am replace template string email with my email

String result=template.replace("{email}", email.toLowerCase());

//replaceing first name

result=result.replace("{first_name}", modifiedFirstName);

System.out.println("================================================================");

//printing results

System.out.println(result);

}

System.out.println("END");

}

}

Emails To: From: Subject: Deals! jbutlerChotmail.conm noreply@deals.com Hi James, Weve got some great deals for you. Check our website! josephine_darakjyEdarakjy.org To: From: noreply@deals.com Subject: Deals! Hi Josephine, Weve got some great deals for you. Check our website! To: From: Subject: Deals! art@venere.org noreply@deals.com Hi ART, Weve got some great deals for you. Check our website!

//////////////////////////////////////MAIN LOGIC/////////////////////////////////

Add a comment
Know the answer?
Add Answer to:
Java Email Template Application: Create an application that creates a series of emails as outlined below....
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • In C++ please! Project 6-1: Email Creator Create a program that reads a file and creates...

    In C++ please! Project 6-1: Email Creator Create a program that reads a file and creates a series of emails Console Email Creator jbutler@gmail.com noreply@deals.com Тo: From: Subject: Deals! Hi James, We've got some great deals for you. Check our website! josephine_darakjy@darakjy.org noreply@deals.com To From Subject: Deals! Hi Josephine, We've got some great deals for you. Check our website! art@venere.org To From noreply@deals.com Subject: Deals! Hi Art We've got some great deals for you. Check our website! Specifications Your instructor...

  • I need help with this Java question. Please only answer in Java. Also, please answer it...

    I need help with this Java question. Please only answer in Java. Also, please answer it as simple as possible thanks. Create an application that reads a file that contains an email list, reformats the data, and writes the cleaned list to another file. Console File Cleaner Source file:  prospects.csv Cleaned file: prospects_clean.csv Congratulations! Your file has been cleaned! The prospect.csv file FIRST,LAST,EMAIL james,butler,jbutler@random.com Josephine,Darakjy,josephine_darakjy@darakjy.org ART,VENERE,ART@VENERE.ORG The prospect_clean.csv file First,Last,email James,Butler,jbutler@random.com Josephine,Darakjy,josephine_darakjy@darakjy.org Art,Venere,art@venere.org Specifications Your instructor should provide a CSV file...

  • I can't get the program to read from prospect.csv file and produce the correct prospect_clean.csv file....

    I can't get the program to read from prospect.csv file and produce the correct prospect_clean.csv file. Can you help with explanation to the answer? Project 15-3: File Cleaner Create an application that reads a file that contains an email list, reformats the data, and writes the cleaned list to another file. Console File Cleaner Source file:  prospects.csv Cleaned file: prospects_clean.csv Congratulations! Your file has been cleaned! The prospect.csv file FIRST,LAST,EMAIL james,butler,jbutler@gail.com Josephine,Darakjy,josephine_darakjy@darakjy.org ART,VENERE,ART@VENERE.ORG ... The prospect_clean.csv file First,Last,email James,Butler,jbutler@gail.com Josephine,Darakjy,josephine_darakjy@darakjy.org Art,Venere,art@venere.org...

  • Hello can somebody please help me with Project 15-3 File Cleaner assignment? This project is to...

    Hello can somebody please help me with Project 15-3 File Cleaner assignment? This project is to be done while using Java programming. Here are what the assignment says… Create an application that reads a file that contains an email list, reformats the data, and writes the cleaned list to another file. Below are the grading criteria… Fix formatting. The application should fix the formatting problems. Write the File. Your application should write a file named prospects_clean.csv. Use title case. All...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT