parameter.    PrintFollowers function in Twitter class should be defined correctly. It displays the name of all the followers. (Remember: each follower is an object of the template parameter. As you will declare Profile struct which can be a template parameter, for the Profile struct, we must overload stream insertion << operator. Now, we can use cout << follower to display the follower).    Submitting a main program that tests the Twitter class as follows: Twitter object Twitter object Whenever any change is made to a Twitter object (like a follower is added, a follower is removed), call PrintFollowers to display the followers of the Twitter object. Hints to be followed: Your Profile struct definition along with overloaded << operator could look like the following. Note that you define the Profile struct in your main program (not in the header). You may also need to overload the == operator for the RemoveFollower function. struct Profile {     string userName;     int age;     string state; } ostream& operator << (ostream & output, const Profile &p) {     output << p.userName;     return output;  }

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

!!!FIRST READ EVERYTHING WRITTEN BELOW AND IF YOU CAN DO IT ONLY THEN START AND NO PLAGIARISM!!!

Only use C++ to do this task. And I will only give thumbs up if you do not plagiarize from another Chegg or internet source. Also only if you will follow all the below instructions 100%.

Only write typed answer. No handwritten.

Code must visibly shows the functions and class.

Attach the screenshot of output and code must be 100% complete and correct.

Write a Twitter class that sets the Twitter user first (who is to be followed) and lets the client add up to 5 followers, which will be stored in an array with a capacity of 5. These users/followers could be in the form of string or Profile but both must be of same type. (Note that the followers are not stored as users, but as strings or Profiles).

At any time, your main program should be able to remove any user, x from following another user, y (i.e., x is no longer in the array of followers of y). You are free to design your program as you wish as long as you fulfill the following requirements:

Twitter class should be declared as a template class (the template parameter defines how the followers are represented)   

Twitter class includes a constructor that initializes the name of the user that is passed. The number of followers starts off at 0.   

AddFollower function in Twitter class should be defined correctly. It takes as parameter an object of the template parameter.

RemoveFollower function in Twitter class should be defined correctly. It takes as parameter an object of the template parameter.   

PrintFollowers function in Twitter class should be defined correctly. It displays the name of all the followers. (Remember: each follower is an object of the template parameter. As you will declare Profile struct which can be a template parameter, for the Profile struct, we must overload stream insertion << operator. Now, we can use cout << follower to display the follower).   

Submitting a main program that tests the Twitter class as follows:

Twitter <String> object

Twitter <Profile> object

Whenever any change is made to a Twitter object (like a follower is added, a follower is removed), call PrintFollowers to display the followers of the Twitter object.

Hints to be followed:

Your Profile struct definition along with overloaded << operator could look like the following. Note that you define the Profile struct in your main program (not in the header). You may also need to overload the == operator for the RemoveFollower function.

struct Profile {

    string userName;

    int age;

    string state;

}

ostream& operator << (ostream & output, const Profile &p)

{

    output << p.userName;

    return output; 

}

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY