Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Here is post.java import java.util.Date; public class Post { private String comments; private String username; private String post; private Date time; private int happy; private
Here is post.java
import java.util.Date; public class Post { private String comments; private String username; private String post; private Date time; private int happy; private int sad; private int surprised; private int blank; public Post(String username, String post){ this.username = username; this.post = post; this.time = java.util.Calendar.getInstance().getTime(); this.comments = ""; } public String getComments(){ return this.comments; } public String getAuthor(){ return this.username; } public String getPost(){ return this.post; } public Date getTime(){ return this.time; } public int getHappy(){ return this.happy; } public int getSad(){ return this.sad; } public int getSurprised(){ return this.surprised; } public int getBlank(){ return this.blank; } public void react(int reaction){ if(reaction == 0) this.happy++; else if (reaction == 1) this.blank++; else if (reaction == 2) this.sad++; else if (reaction == 3) this.surprised++; } public void addComment(Comment comment){ this.comments += comment.display(); } public void display() { /*TODO*/ String s = String.format( "%s on (%s): " + "'%s' " + "=)(%d) =|(%d) =((%d) =O(%d) " + "Comments: " + "%s" , this.getAuthor(), this.getTime(), this.getPost(), this.getHappy(), this.getBlank(), this.getSad(), this.getSurprised(), this.getComments() // add the required values here ); System.out.println(s); } }
comment.java
import java.util.Date; public class Comment { private Date time; private String author; private String content; /** * The getter and setter functions */ public Date getTime() { return this.time; } public String getAuthor() { return this.author; } public String getContent() { return this.content; } /** * The constructor */ public Comment(String author, String content) { this.content = content; this.author = author; this.time = java.util.Calendar.getInstance().getTime(); } /** * The display comment */ public String display() { /*TODO*/ String s = String.format( "->'%s' - %s (%s): " , this.getContent(), this.getAuthor(), this.getTime() // add the required values here ); return s; } } Post wall.java
import java.util.ArrayList; import java.util.List; public class PostWall { private Listposts; public PostWall() { posts = new ArrayList(); } public void generate() { for (Post post : posts) { post.display(); System.out.println(" "); } } public void addPost(Post post) { posts.add(post); } }
Please confirm postwall .java and generate message.post
MessagePost: o 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) =0(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) =0(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) =0(0) Comments: -> 'Yes.' Jude Alkingtomie (Sun Dec 06 14:24:06 EST 2020) -> 'Nothing... >:)' - Grinch Grinch (Sun Dec 06 14:24:06 EST 2020) MessagePost: o 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) =0(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) =0(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) =0(0) Comments: -> 'Yes.' Jude Alkingtomie (Sun Dec 06 14:24:06 EST 2020) -> 'Nothing... >:)' - Grinch Grinch (Sun Dec 06 14:24:06 EST 2020)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started