Question: Q 2 . ( 7 0 marks ) Social Media Platform Simulation. Design a system that simulates a basic social media platform where users can
Q 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.
User Class represents each user on the platform, with profile information and a list of posts. It has the
following attributes: userIDint a unique identifier for each user. usernamestring 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:
Get and set functions for username;
createPost Creates a new Post and adds it to the posts list.
listPosts Prints all posts by the user, displaying post IDs, content, likes.
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:
addLike Increments the likes count.
addComment Adds a comment to comments.
viewPost Displays the content, number of likes, and all comments.
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:
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.
removeUser Removes a user by userID.
findUserByUsername Returns a pointer to a User given the username.
createPostForUser Allows a specific user to create a post.
likePost Increments likes for a specific post by a specific user.
commentOnPost Allows a user to comment on another user's post.
viewUserProfile Prints a users profile with posts, likes, and comments.Requirements:
Create a file called user.h for the User class definition.
Create a file called post.h for the Post class definition.
Create a file called socialmediaplatform.h for the SocialMediaPlatform class definition.
Implement each class in separate files: user.cpp post.cpp and socialmediaplatform.cpp
Write a main function in a file called ssocialmediatest.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
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
