Question: THE CODE SHOULD BE WRITTEN IN JAVA The super class post.java: import java.util.Date; public class Post { private String comments; private String username; private String

THE CODE SHOULD BE WRITTEN IN JAVA

THE CODE SHOULD BE WRITTEN IN JAVA The super class post.java: import

The super class 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 { // member variables private Date time; private String author; private String content; // Getter function public Date getTime() { return this.time; } public String getAuthor() { return this.author; } public String getContent() { return this.content; } // Constructor public Comment(String author, String content) { this.content = content; this.author = author; this.time = java.util.Calendar.getInstance().getTime(); } // Function to return comments in proper format as string public String display() { /*TODO*/ String s = String.format( "->'%s' - %s (%s): " , this.getContent(), this.getAuthor(), this.getTime() // add the required values here ); return s; } } 

Video Post: o This subtype of Post is very similar to its superclass. A disclaimer should be displayed above the entire post (1.e. on top of it). The disclaimer should say "VIEWER DISCRETION ADVISED" if it is set when the Video Post is instantiated. o Content in a Video Post will be a url. These should simply be Strings

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!