Question: How would I code these three classes? Also, could you put in comments to explain your logic behind designing the class that way. I want

 How would I code these three classes? Also, could you put

in comments to explain your logic behind designing the class that way.

I want to have a better understanding of correct syntax. The set

How would I code these three classes? Also, could you put in comments to explain your logic behind designing the class that way. I want to have a better understanding of correct syntax.

The set of classes will include Tweet, TweetDB, and a Tester class. Description: Tweet Class Tweet class would implement comparable interface. Therefore, tweet objects can be sorted based on Date-time. The Tweet class stores information about the tweet. Tweet class has following data members: private String userID; // stores the user id private Date date; // convert the date-time string to a java.util.Date format private String tweet; // stores the tweeted message The Tweet class should have the following constructor: *public Tweet (String userID. String dateTime, String tweet) This constructor takes three strings for user id, date-time and text. Set the values using mutators. The String dateTime should be converted to a java.util.Date. The Tweet class must implement the following methods: - Mutator an accessor for every data member. Check appropriate exception here. public String toString 0 This method returns a string containing user id, date of tweet and tweet text. public boolean equals(Object other) For this assignment, consider two tweets are equal if the tweeted text are equal public int compareTo(Tweet o) Override compareTo() method to compare two tweet objects based on their Date-time. TweetDB Class The TwitterDB class keeps a database of tweets. This class should have the following data members: private String comment; // describes the contents of the tweets database private ArrayList tweets; // stores all the tweets TwitterDB class should have the following constructor: public TwitterDB(String comment) The constructor sets the comment instance variable. It also creates an empty ArrayList object tweets. TwitterDB class should implement the following methods: Accessor and mutator for comment data member. public void addTweet(Tweet tweet) This method adds the tweet passed as the argument to the tweets ArrayList. *public int getNumberOfTweets() This method returns the number of tweets stored in the tweets ArrayList. public Tweet getTweet(int i) Returns the ith tweet in the tweets ArrayList. public ArrayListgetSortedTweet() Sort the tweets based on Date-time. Returns the sorted tweet list. [Hints: Use Collections.sort() method to sort the tweets. For ref. check Chapter 20.6 of textbook. We covered it during Session 6.1] public Boolean isAlreadyStored(Tweet t) This method checks whether Tweet t is already in the list. [Hints: equals() method would be used to see if the given tweet is equal to any of the tweet in the list in term of tweet text] *public String toStringo Returns the String representation of the tweet database. (Text along with user id and Date- time for all tweets) Tester Class Class to test and use your Tweeter class and TwitterDB class. You should create a twitter data base instance and add tweet information in it (take tweet information from user). Tell user about the format of Date-time string (Hints: the format you would use while parsing String to Date-time using SimpleDateFormat class method). Check the size of list of tweet in TwitterDB. Get the sorted list of tweets (sorted based on Date-time) from Twitter database and print the sorted list. Get and print the tweet at a specific index in the list of tweet. Check whether a tweet is already in the list of tweet in twitter database. Print the list of tweets in the database. All three classes must include complete and correct JAVADOC comments. You do not have to actually generate your JAVADOCs, you only need to write the comment code. You must use the techniques shown in class and use proper spelling and grammar

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!