程序代写代做代考 Maximum points for this work is 40 marks.

Maximum points for this work is 40 marks.
Maximum points for this work is 40 marks.
Assignment 2 – Implement a Tweet Class (Groups of four students)
Due: Demonstration of your code due at the beginning of the last class in Week 4

This assignment attempts to model the social phenomenon twitter. It involves two main classes: Tweet and TweetManager. You will load a set of tweets from a local file into a List collection. You will perform some simple queries on this collection.
The Tweet and the TweetManager classes must be in separate files and must not be in the Program.cs file.
The Tweet Class
The Tweet class consist of nine members that include two static ones (the members decorated with the $ symbol). You will implement this and all of the classes in Visual Studio. A short description of the class members is given below:

Tweet
Class
Fields
-$ CURRENT_ID : int
Properties
+ «property setter absent» From : string
+ «property setter absent» To : string
+ «property setter absent» Body : string
+ «property setter absent» Tag : string
+ «property setter absent» Id : string

Methods
+ «constructor»Tweet(from : string, to : string, body : string tag : string)
+ «constructor»Tweet(from : string, to : string, body : string tag : string, id : string)
+ ToString() : string
+$ Parse(line : string) : Tweet

The $ symbol is used to denote that this member belongs to the type rather than a specific object and you must use the type to access that member.
1 mark
1 mark
• CURRENT_ID – this private field is a class variable, it represents the number to be used in setting the id of this tweet.
Properties:
1 mark
1 mark
• 1 mark
1 mark
• 1 mark
1 mark
• Body – this property is a string representing the actual message body of this tweet. The getter is public and the setter is absent.
• 1 mark
1 mark
• 1 mark
1 mark
5 marks
5 marks
• This is an example of constructor overloading
This is an example of constructor overloading
• Assigns the arguments to the appropriate properties.
• Sets the Id property using the class variable CURRENT_ID.
• 4 marks
4 marks
• public Tweet(string from, string to, string body, string tag, string id) – This public constructor takes five string parameters. This is called by the static Tweet Parse(string) method. This constructor does the following:
• Assigns the arguments to the appropriate properties.
Methods:
• 2 marks
2 marks
• 6 marks
6 marks
• Uses the method of the string class is to chunk the input into four strings. The default delimiter for the Split() method is a space, however in this case the delimiter should be a tab. To specify an argument use the following code: Split(new char[]{‘\t’});
• Invokes the constructor with the five arguments. Because all the arguments are string, it is easy to inter-change the order. You need to xxamine the text file to make sure that you are sending the arguments to the constructor in the required order.
• Return the result of the above invocation

The TweetManager Class
This static class consist of five static members. You will also implement this in Visual Studio. A short description of the class members is given below:

TweetManager
Static Class
Fields
-$ TWEETS : List
-$ FILENAME : string

Methods
$ TweetManager()
+$ Initialize() : string
+$ ShowAll(line : string) : Tweet

ALL MEMBERS ARE STATIC!
1 mark
1 mark
• TWEETS – this private field is a class variable; it is a collection of all the tweets in the system. It is initialized and populated in the static constructor.
• 1 mark
1 mark
A static constructor does not take any arguments, nor does it require any accessibility modifier.
It is called before any member is accessed
A static constructor does not take any arguments, nor does it require any accessibility modifier.
It is called before any member is accessed
7 marks
7 marks
• static TweetManager() – This is the static constructor. It does not require any parameter. This constructor does the following:
• Initialize the tweets field to a new list of tweets
• Opens the file specified by the filename field for reading
• Using a looping structure it does the following:
• Reads one line from the file
• Passes this line to the static Parse() method of the Tweet class to create a tweet object
• The resulting object is added to the tweet collection
• 2 marks
2 marks
• This will be used to test your code in the event you cannot figure out the file reading part
This will be used to test your code in the event you cannot figure out the file reading part
• Assigns the TWEETS field
• 2 marks
2 marks
• 2 marks
2 marks
This is good example of method overloading, i.e. methods with the same name
This is good example of method overloading, i.e. methods with the same name
• public static void ShowAll(string tag) – This is a public class method that takes a string argument that does not return a value. It displays all the tweets with tag matching the argument. This comparison must be case in-sensitive.
2 marks
2 marks
Testing
In your test harness (the Main() method in the Program Class), write the code to test all the methods of the TweetManager class including the Initialize() method