Answered step by step
Verified Expert Solution
Question
1 Approved Answer
4- lextPost Implement the class TextPost. A TextPost is a specialized Post. It stores a text message (String). Override the method toString using the keyword
4- lextPost Implement the class TextPost. A TextPost is a specialized Post. It stores a text message (String). Override the method toString using the keyword "super" in your implementation. A TextPost is considered popular if the post gets more than 50 likes. 5- NewsFeed Write the implementation of the class NewsFeed. A NewsFeed object stores Post messages " It uses a fixed size array of some constant size MAX-SIZE to store Post messages. For this implementation will only accept up to 25 Post messages. .It has a method for adding a Post message. The message is added after the last message added. It has a method sort in which the Post are sorted from the oldest to the most recent. It has a method for returning the message found at a given index, Post getInt index) .It has a method size that returns the number of messages currently stored It has a method getPhotoPost that returns a new object of type NewsFeed containing only the PhotoPost It has an instance method plus that has one formal parameter of type NewsFeed. This method returns a new object of type NewsFeed that represents the combination of the two NewsFeed. The Post of the new NewsFeed have to be sorted from the oldest to the most recent one. . Bonus Write the implementation of the class NewsFeed using a dynamic array (array that automatically changes size) to store Post messages, instead of a fixed size array. The constructor has two parameters, the initial capacity of the array and the capacity increment . Each time the array is full, the implementation should create a new array larger by the capacity increment Implement all the necessary constructors. Each attribute must have a getter method. NTempTemp1 lab4 template.zip Postjava -Sublime Text (UNREGISTERED) File Edit Selection Find View Goto Tools Project Preferences Help Likeable.java NewsFeed,java PhotoPost.java Post,java TextPost.java 1 import java.util.Calendar 2 import java.util.Date; 4 public class Post implements Likeable, ComparablexPost> protected int likes; private Date timeStamp; private String userName; 10 public Post(String userName) /Your code here 12 13 14. 15 16 17 18 19 20 21 public String getUserName) f return userName; public Date getTimeStamp) return timeStamp; // Implement the methods required by the interface Likeable // This file wil1 not compile unless they are present with the correct name and signature 23 24 25 26 27 28 29 30 31 32 public String toString) String str new String(); str getClass().getName()+":" +timeStamp ", "userName ", likeslikes return str; public int compareTo(Post other) Line 1, Column 1 Spaces 2 a12:30 PM 2 /7 /2019 Type here to search NTempTemp1 lab4 template.zip TextPostjavaSublime Text (UNREGISTERED) File Edit Selection Find View Goto Tools Project Preferences Help likeable-Jawa NewsFeed,java PhotoPost.java Post,java TextPost,java 1 public class TextPost extends Post private String message; public TextPost (String userName, String message) f /Your code here public String getMessage() 10 return message,; 12 13 14. 15 16 17 18 19 20 21 public String toString) String str new String(); str = super.toString() + ", " + message; return str public boolean isPopular()f // Your code here 23 24 Spaces 2 a12:30 PM 2 /7 /2019 Type here to search
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