Question: Problem 3.1~ In this problem you will be coding the PostWall class. A PostWall object is composed of (or an aggregation of) many Post objects.

 Problem 3.1~ In this problem you will be coding the PostWall
Problem 3.1~
In this problem you will be coding the PostWall class.
A PostWall object is composed of (or an aggregation of) many Post objects. These Post objects should be arranged in a vertical fashion, separated by a divider.
PostWall has some methods:
generate()
This method should generate the current "wall" made up of all the posts contained in the PostWall object.
It should be printed out vertically, by calling each Post's display() method. Posts should be separated by a divider.
addPost()
This method must take a Post object and add it to the PostWall's list of Posts.
Remember, a post can be any of the above Post subtypes (VideoPost, MessagePost, PollPost).
~Problem 3.1 (continued)~
This is Problem 3.1 continued. You will be coding the VideoPost, PollPost, MessagePost, Comment classes.
You need to determine which of these classes should subclass Post. Feel free to completely refactor the Post class to make effective use of method overrides and overloads. You can assume an instance of Post will never be used in the PostWall, i.e. it will always be a VideoPost, PollPost, or MessagePost. In the future, Post would be a good candidate for an interface. In general, you should always code against an interface when implementing your polymorphic behaviour. But this is a topic for a future lab.
While inheritance is a viable strategy for this lab, composition could be a better solution. We will stick to inheritance for this lab because we want to be able to handle Post objects in a polymorphic manner within the PostWall class (we want to be able to call display() across all Posts on the wall).
Comment:
This is a class that will be used to model comments. Comments get displayed on other posts, never on their own.
A Comment has a message (could be content), an author, and a time.
A Comment cannot be commented on. A Comment cannot be reacted to.
VideoPost:
This subtype of Post is very similar to its superclass. A disclaimer should be displayed above the entire post (i.e. on top of it). The disclaimer should say "VIEWER DISCRETION ADVISED" if it is set when the VideoPost is instantiated.
Content in a VideoPost will be a url. These should simply be Strings.
PollPost:
This subtype of Post is different in that it can be "reacted" to in two ways. This post should still be displayed with the emoji counters, but users can also submit a String answer. These will typically be a single word and can be anything!
A PollPost should have a poll question and answers to the poll question as its content section.
Notice the answers contain a count next to them, and they are not sorted. You can use the StringIntPair class provided to simplify your collection of poll answers in PollPost.
MessagePost:
This subtype of Post should essentially be the Post class you created in section 2.0. It should have a message as content and display identically to the Post class from section 2.0.
A call to PostWall.generate() with an example of each type of post is displayed below for reference.
Chris Mascarolls on (Sun Dec 06 14:24:06 EST 2020):
'Deck the halls.'
=)(32) =|(13) =((1) =O(0)
Comments:
-> 'What are your plans?!' - Wanda Nauwittol (Sun Dec 06 14:24:06 EST 2020)
-> 'Yay!' - Jude Alkingtomie (Sun Dec 06 14:24:06 EST 2020)
-> 'Nope!' - Grinch Grinch (Sun Dec 06 14:24:06 EST 2020)
--------------------------------------------------
-VIEWER DISCRETION ADVISED-
Grinch Grinch on (Sun Dec 06 14:24:06 EST 2020):
'This bumps! https://www.youtube.com/watch?v=GAs67cRfmQI&ab_channel=Tyler%2CTheCreator-Topic'
=)(1) =|(13) =((0) =O(0)
Comments:
--------------------------------------------------
Wanda Nauwittol on (Sun Dec 06 14:24:06 EST 2020):
'What's everyone doing for Christmas Break!?'
Eat! (2)
Eat (1)
Celebrate (2)
Not study! (3)
=)(5) =|(3) =((1) =O(0)
Comments:
-> 'Yes.' - Jude Alkingtomie (Sun Dec 06 14:24:06 EST 2020)
-> 'Nothing... >:)' - Grinch Grinch (Sun Dec 06 14:24:06 EST 2020)
--------------------------------------------------
// Main.java
public class Main {
public static void main(String[] args) {
// ...
}
}
------------------------------------------
// StringIntPair.java
public class StringIntPair {
public final String s;
public final int i;
public StringIntPair(String s, int i) {
this.s = s;
this.i = i;
}
}
please help with java, add comment for more informtion(transcribed image text of question provided)

- Problem 3.1- In this problem you will be coding the PostWall class. A PostWall object is composed of (or an aggregation of many Post objects. These Post objects should be arranged in a vertical fashion, separated by a divider PostWall has some methods generato (3) This method should generate the current wall" made up of all the posts contained in the PostWalt object. It should be printed out vertically, by calling each Post's display() method Posts should be separated by a divider addpost) . This method must take a Post object and add it to the Post Wall's list of Posts. Remember, a post can be any of the above Post subtypes (VideoPost, MessagePost, Pollpost) - Problem 3.1- In this problem you will be coding the PostWall class. A PostWall object is composed of (or an aggregation of many Post objects. These Post objects should be arranged in a vertical fashion, separated by a divider PostWall has some methods generato (3) This method should generate the current wall" made up of all the posts contained in the PostWalt object. It should be printed out vertically, by calling each Post's display() method Posts should be separated by a divider addpost) . This method must take a Post object and add it to the Post Wall's list of Posts. Remember, a post can be any of the above Post subtypes (VideoPost, MessagePost, Pollpost)

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 Databases Questions!