Question: Q 2 . ( 7 0 marks ) Social Media Platform Simulation. Design a system that simulates a basic social media platform where users can

Q2.(70 marks) Social Media Platform Simulation. Design a system that simulates a basic social media
platform where users can create profiles, post content, and interact with other users posts by liking and
commenting. You need to create three classes: User class, Post class, SocialMediaPlatform class. The
requirements for each class are as follows.
1. User Class represents each user on the platform, with profile information and a list of posts. It has the
following attributes: userID(int, a unique identifier for each user.), username(string), bio (string, a brief
description of the user.), posts (vector of Post objects containing a list of the users posts.)
It has the following Member Functions:
1) Get and set functions for username;
2) createPost - Creates a new Post and adds it to the posts list.
3) listPosts - Prints all posts by the user, displaying post IDs, content, likes.
2. Post class represents individual posts created by users. Each post includes content, a count of likes, and
comments from other users. It has the following attributes: postID (int, A unique identifier for each post),
content (string, The content of the post), likes (int, Number of likes the post has received), comments (vector
of string, A list of comments on the post).
It has the following Member Functions:
1) addLike - Increments the likes count.
2) addComment - Adds a comment to comments.
3) viewPost - Displays the content, number of likes, and all comments.
3. SocialMediaPlatform class manages the entire platform, including user registration, post creation, and user
interactions. It has the following attributes: users (vector of User objects, A list of all registered users).
It has the following Member Functions:
1) registerUser - Adds a new User to the platform by taking username and bio as input. Whenever register
a new user, a userID should be set as well. The userID is not input by the user, instead it is assigned by
the program. userID should be unique without repetition.
2) removeUser - Removes a user by userID.
3) findUserByUsername - Returns a pointer to a User given the username.
4) createPostForUser - Allows a specific user to create a post.
5) likePost - Increments likes for a specific post by a specific user.
6) commentOnPost - Allows a user to comment on another user's post.
7) viewUserProfile - Prints a users profile with posts, likes, and comments.Requirements:
1) Create a file called user.h for the User class definition.
2) Create a file called post.h for the Post class definition.
3) Create a file called socialmediaplatform.h for the SocialMediaPlatform class definition.
4) Implement each class in separate files: user.cpp, post.cpp, and socialmediaplatform.cpp.
5) Write a main function in a file called ssocialmedia_test.cpp to do the following:
Prompt the user to create multiple users.
Allow users to create posts, like posts, and comment on posts.
Display user profiles and test all member functions.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!