Answered step by step
Verified Expert Solution
Question
1 Approved Answer
This is what I have to do: Generate unique usernames based on first initial and last name. If a username is already taken, then add
This is what I have to do: Generate unique usernames based on first initial and last name. If a username is already taken, then add an increasing numeral to it
a Output the student name, username and ID to a second file
Example input file:
Smith, Mary
and later on there is
Smith, Michelle
Output to a file, maybe existingStudentstxt
Consider overloading the
It might look like:
Mary Smith,Amsmith
Michelle Smith,Amsmith
or msmith if you want just as long as they are different.
b Create a way to read in the file above and set Student values. Here, each student might be read in and the ID would be set explicitly.Consider overloading the operator
This is what I have so far: #include
#include "Prof.h
#include "UnivMember.h
using namespace std;
Professor:: Professor : UnivMember
username no userName" ;
pName getUnivName; the private members of the base class UnivMember cannot be accessed by the derived class
pID getUnivID;
Professor:: Professorstring emailName, Name profName, ID profID
username emailName;
pName profName.getFirstName profName.getLastName;
pID profID.getfull;
Professor:: ~Professor
void Professor:: PrintAll
cout "Name: pName endl;
cout "Email: username @fordham.edu" endl;
cout ID: pID endl endl;
void Professor:: setUsernamestring emailName
username emailName;
void Professor:: setNameName profName
pName profName.getFirstName profName.getLastName;
void Professor:: setIDID profID
pID profID.getfull;
string Professor:: getUsername
return username;
string Professor:: getName
return pName;
string Professor :: getID
return pID;
ostream& operatorostream& outs, const Professor& prof
outs "Name: Prof.getName endl;
outs "Email: prof.getUsername@fordham.edu
;
outs ID: prof.getID endl;
return outs;
istream& operatoristream& ins, Professor& prof
string fullName, username, numID;
getlineins fullName;
ins username numID;
return ins;
~#include
#include
#include
#include
#include
#include "Prof.h
using namespace std;
string createUsernameName profNamefunction to create the username
string firstName profName.getFirstName;
char firstInitial firstName.at; first inital of first name
tolowerfirstInitial;
tolowerprofNamegetLastNameat;
string username firstInitial profName.getLastName;
return username;
int main
ifstream infile; will be reading from a file
ofstream outfile; will be inputing into a file
string profName; to parse the file names of profs
string pEmail;
infile.openCSProfNamestxt; file containing professor names
ifinfile.isopentesting to ensure that the file is open
cout "File is not open." endl;
exit ;
vector profVector; vector to hold the professors made
whilegetlineinfile profName
Name pNameprofName;
ID pID;
pEmail createUsernamepName;
Professor profpEmail pName, pID;
profVector.pushbackprof; adding the prof to the vector
outfile.openexistingProfessorstxt; file does not exist but ofstream will create one
testing to ensure file is open
ifoutfile.isopen
cout "File is not open
;
return ;
can you adjust it so i am using the overloaded and and finish the code for me quickly please
Step 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