Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

IN C++ Write a Twitter class that sets the Twitter user first (whos to be followed) and lets the client add up to 5 followers.

IN C++

Write a Twitter class that sets the Twitter user first (whos to be followed) and lets the client add up to 5 followers. These users/followers could be in form of string or Profile*. At any time your main program should be able to remove any given user from the follower list, which will be stored in an array with a capacity of 5. You need to have a function which can print all followers at any time and calling this function after a removal is a requirement. You are free to design your program with your own will as long as you fulfill the followings:

1. Main program should use the Twitter class template, which you should write in a separate .h file. (10 points)

2. In the main program two types objects need to be created, i.e.,

a. Twitter (10 points)

b. Twitter (10 points) where Profile is a struct that contains three fiels (username, age, state)

3. A constructor which does initialization for the followed user and number of followers. (5 points)

4. AddFollower function (10 points)

5. RemoveFollower function (10 points) (Hint: you may need to check whether the given user and the array member are equal to each other. Profile struct may require an overloaded operator=)

6. PrintFollower function. (10 points) (This should be called after removal of a user) (Hint: cout<< works with string, but you should add the overloaded operator below in your code to be able to print a Profile object)

* struct Profile{ string username; int age; string state; };

Thank you! Please add comments explaining what he main code parts do.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions