Question: In the file Dril 1 3 . java, write a class called VideoComment that has three fields: one field called text of type String, one

In the file Dril13. java, write a class called VideoComment that has three fields: one field called text of type String, one field called likes of type int, and one field called replies of type int. Give it a constructor of three arguments that initializes those fields. In it, write the following methods:
hasMention which takes a String called username and checks if the string @ followed by that username apppears in the Comment contents, returning true if it does and false otherwise. (There are some interesting cases for this method. For example, to check if we have the username "dummy in @dummy1 @dummy2", hasMention() should return false in this case because username dummy and dummy2 is not the same as dummy, while "hello @dummy world" and "CSE 11 is a cool class @dummy" should return true)
hasReply which takes no arguments and returns true if the comment has one or more replies, false otherwise.
firstMention which takes no arguments and returns a String containing the substring between the first appearance of the @ character in the text and the first space character after that. Do not include the @ character and the space character. If there is no space after the @, or if there's no @, then an empty string "" should be returned.
(You may find some String methods in the Java documentation useful)
Also in Dril13. java, write a class called CommentReply that has four fields: one called replyTo of type Videocomment, one called text of type String, one called likes of type int, and one field called replies of type int. Give it a constructor of four arguments that initializes these fields. In it, write the following methods:
morePopularReply which takes no arguments and returns true if this CommentReply has more likes than the VideoComment it is replying to
allLikes which takes no arguments and returns the sum of the likes on this CommentReply and
 In the file Dril13. java, write a class called VideoComment that

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!