Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

2-Post Write the implementation of the class Post. It implements the characteristics that are common to its sub-classes, here TextPost and PhotoPost. .Post implements the

image text in transcribedimage text in transcribedimage text in transcribed

2-Post Write the implementation of the class Post. It implements the characteristics that are common to its sub-classes, here TextPost and PhotoPost. .Post implements the interface Likeable All the Post messages have a user name, a time stamp (of type java.util.Date), as well as a count for the number of likes. The value of the time stamp is automatically assigned when an object is created. Use java.util.Calendar.getinstance).getTime() to obtain a Date object representing the current time. A Date object has a method toString that converts this date to a String ate rightNou-Calondar-gotInstanca)goti); System.out.println(rightNow) Each call to the method like) increases the number of likes for this message. Post implements the interface Comparable. This interface allows you to compare two Post according to specific criteria. In this case the criteria will be the date of the post. For more information, refer to the Add the method isPopular. This method returns true if the post is considered popular (more the 100 likes), false otherwise. Do not forget the method toString0! 3- PhotoPost Implement the class PhotoPost. A PhotoPost is a specialized Post. It stores a file name and a caption. Override the method toString) by using the keyword "super" in your implementation NTempTemp1 lab4 template.zip NewsFeed javaSublime Text (UNREGISTERED) File Edit Selection Find View Goto Tools Project Preferences Help Likeable-java 3 with constant MAX SIZE NewsFeedjava PhotoPost,java Post,java TextPost.java 4 6 public class NewsFeed f 9 10 private Post[] messages; private int size; public static final int MAX SIZE = 25; public NewsFeed() 12 13 14 15 16 17 18 19 20 21 // Your code here public void add (Post message) // Your code here public Post get(int index) return messages [index]; 23 24 25 26 27 28 29 30 31 32 public int size) return size; public void sort)f int i, j, argMin; Post tmp; for (i = 0; size . 1; i++) { argMin i for (j = i + 1; j

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Management System MCQs Multiple Choice Questions And Answers

Authors: Arshad Iqbal

1st Edition

1073328554, 978-1073328550

Students also viewed these Databases questions

Question

Identify conflict triggers in yourself and others

Answered: 1 week ago