Question: In java /** * Abstract Post class abstract class Post { /** * Number of likes on this post */ private int numLikes; /** *

In java /** * Abstract Post class abstract class Post { /**In java

/** * Abstract Post class abstract class Post { /** * Number of likes on this post */ private int numLikes; /** * Add a like to this post */ public void addLike() { this.numLikes += 1; /** * Get number of likes on this post * @return Number of likes on this post public int getNumLikes() { return this.numLikes; /** * Get the popularity of this post * Defines "popularity" as number of likes * @return the popularity of this post */ public int get Popularity() { return this.numLikes; TASK: Create a class called Video Post that extends the Post abstract class and has the following properties: It should have a private instance variable of type int called numViews to keep track of the number of video views It must have a public no-parameter constructor that initializes its instance variables to 0 (the default one provided implicitly by Java is fine) It must have a public instance method called getNumViews that returns the number of views It must have a public void instance method called addView that increments the number of views It must override the get Popularity method to instead define "popularity" as number of views NOTE: Ignore the "Sample Input:" and "Sample Output:" sections immediately below this. They are always shown by Stepik, even if they're not used. The "CORRECT" message is something that is being used behind-the-scenes in the grading system

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!