Question: In this mini project, you are asked to implement and test an Account abstract data type that could be useful for a social media app
In this mini project, you are asked to implement and test an Account abstract data type that could be useful for a social media app to manage its accounts.
The Account class definition has been provided for you in the Accounth file of the minisocialmedia project. You are not allowed to make any change to the class definition.
Here are more details about the private data members:
The username data member is to store the username for an account.
The password data member is to store a secure password for the account.
The following data member is to store the usernames of all the accounts followed by the current account owner.
The nFollowing data member is to store the number of accounts followed by the current account owner.
Your task is to implement the member functions of the Account class in the Accountcpp The maincpp file is to include code that supports the thorough testing of these member functions. You are welcome but not required to create additional functions to support your testing. Make a copy of the Mini Sample Run Document and, as you make progress in testing the functions, capture related screenshots that demonstrate proper testing of related functions into the document. At the end, save the document in PDF and upload it to Canvas.
Here are more details for the public member functions you need to implement and test:
Account::Accountconst string& username;
This function is to create an Account object using the username provided as the value for the username member of the new object. A new account just constructed should not have followed anyone. In addition, the constructor shall randomly create a secured password that satisfies the following criteria:
It shall be between and characters. Do not assume a fixed length password for all accounts. One account password may be characters long while another may be characters long.
It shall contain at least one uppercase letter, at least one lowercase letter, at least one digit, and at least one of the following special characters: #$&
It shall not follow any pattern that would be easy to recognize when someone sees a few passwords generated by your program. For example, avoid always having a letter for the first character or always having two digits in a row or always using the same lettersdigits and just changing the order. Be creative in your randomness. Do not copy others algorithms.
string Account::tostringconst;
This function is to return a string object that contains details of the invoking Account object. It shall be called from the main function to help you demonstrate the other member functions properly update related data members of an Account object.
For example, given the following statements in the main function:
The following output would be generated:
And here is a sample output of cout atostring endl; after it follows a few people:
bool Account::followconst string& username;
This function is to return false if the invoking account is already following the username provided or the array is already at its capacity. No change shall then be made to any data member of the invoking account. Otherwise, it adds the username to the following array data member, updates the nFollowing data member, and returns true.
bool Account::unfollowconst string& username;
This function is to return false if the invoking account is not currently following the username provided. No change shall then be made to any data member of the invoking account. Otherwise, it removes the username from the following array data member by shifting the related elements forward, updates the nFollowing data member, and returns true.
string Account::getfollowingconst string& key const;
This function is to perform a keyword search through the following array and return a string of all matching usernames, formatted in a nice tabular format. You are required to use a stringstream object along with parametric manipulator to help you organize the format of the string to be returned. It shall not change any of the data members of the object. If no match is found, the function shall return an empty string.
By default, the value for key is an empty string, indicating the returned string of the function shall include all usernames in the following array, from the oldest to the newest. However, if a nonempty string is presented for the key parameter, the returned string shall include only usernames containing the key as its substring.
For example, here is a sample output of cout agetfollowing endl; showing the top tech influencers being followed:
And here is a sample output of cout agetfollowinger endl; showing only those with the string er as part of their namesThis file contains the definition of the Account class. Do not change anything in this
file.
#ifndef ACCOUNTH
#de
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
