Email Address Creation : A company named Creative Engineering develops email add
ID: 3764590 • Letter: E
Question
Email Address Creation: A company named Creative Engineering develops email addresses for their employees by using the first 5 digits of their last name (or all digits if less than 5), the first digit of their first name, and the last 3 digits of their EmployeeID, followed by “@creative.com”. Write a program that will prompt the user to enter his/her last name, first name, and their EmployeeID. The program should then display their email address. Turn in a printout of the program and the results for the 3 cases below. The 3rd case uses your name and any 7-digit EmployeeID you pick (make one up).
Inputs
Output
Last Name: Stephens
First Name: Clarence
EmployeeID: 7654321
Your email address is StephC321@creative.com
Last Name: Doe
First Name: John
EmployeeID: 1020030
Your email address is DoeJ030@creative.com
Last Name: (yours)
First Name: (yours)
EmployeeID: (pick one)
Your email address is …
only use these libraries
#include <iostream>
#include <string>
#include <cctype>
#include <cmath>
#include <iomanip>
#include <sstream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <numeric>
using namespace std;
thanks!!
Inputs
Output
Last Name: Stephens
First Name: Clarence
EmployeeID: 7654321
Your email address is StephC321@creative.com
Last Name: Doe
First Name: John
EmployeeID: 1020030
Your email address is DoeJ030@creative.com
Last Name: (yours)
First Name: (yours)
EmployeeID: (pick one)
Your email address is …
Explanation / Answer
Here is the code for you. If you need any further modification, just get back to me.
#include <iostream>
#include <string>
using namespace std;
int main()
{
string lastName, firstName, ID;
cout<<"Enter the last name: ";
cin>>lastName;
cout<<"Enter the first name: ";
cin>>firstName;
cout<<"Enter the employee id: ";
cin>>ID;
string email = "";
int size = lastName.length();
if(size <= 5)
email = lastName;
else
email = lastName.substr(0, 5);
email.append(firstName.substr(0,1));
email.append(ID.substr(ID.length()-3, 3));
email.append("@creative.com");
cout<<"LastName: "<<lastName<<endl;
cout<<"FirstName: "<<firstName<<endl;
cout<<"ID: "<<ID<<endl;
cout<<"Your email address is: "<<email<<endl;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.