Answered step by step
Verified Expert Solution
Question
1 Approved Answer
This assignment attempts to model this social phenomenon. It involves an enum and two main classes: Audience, TikTok and TiktokManager. You will load a set
This assignment attempts to model this social phenomenon. It involves an enum and two main classes: Audience, TikTok and TiktokManager. You will load a set of tikoks from a local file into a List collection. You will perform some simple queries on this collection. The Tikok and the TikokManager classes must be in separate files and must not be in the Program.cs file. The Audience enum may be implemented in the Tiktok.cs file. The Audience Enum [5 marks] This enum specifies the intended audience for this tiktok. It consists of three constants as shown in the table below: Audience Enum Constants World Group Special Acti do to The TikTok Class The TikTok class consist of ten 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: TikTok Class Fields -$ _ID :int Properties + Originator + Length + HashTag + Audience : string : int : string : Audience : string + Id Methods : string, : int, : string, : Audience) + + constructorTikTok ( originator length hashTag audience constructorTikTok ( id originator length hashTag audience + ToString() +$ Parse(line : string) : string, : string, : string, : string, : string) : string : TikTok The $ symbol is used to denote that this member belongs to the type rather than a specific object Ac and you must use the type to access that member. Go to Fields (15 points]: 1. _ID- this private field is a class variable, it represents the number to be used in setting theid of this item. Properties (10 points]: All of the properties are readonly and are self-explanatory. 1. Originator - this property is a string representing the originator of this tikok. The getter is public and the setter is absent. 2. Length - this property is an int representing the length in second recipient of this tikok. The getter is public and the setter is absent. 3. HashTag - this property is a string representing the hashtag of this tikok. The getter is public and the setter is absent. 4. Audience - this property is a string representing the distribution of this tikok. The getter is public and the setter is absent. 5. Id - this property is a string representing the id of this tikok. The getter is public and the setter is absent. This is used to uniquely identify a tikok. Constructors [20 points]: 1. public TikTok (string originator, int length, string hashTag, Audience audience) - This constructor does the following: This is an example of constructor overloading a. Assigns the arguments to the appropriate properties. b. Sets the Id property using the class variable _ID. After the Id property is set, the _ID is then incremented so that the next assignment will be unique. (see description of Id above) Activa C. will be unique. (see description of Id above) 2. private TikTok(string id, string originator, string length, string hashTag, string audience) - This is called by the static TikTok Parse(string) method. This constructor does the following: a. Assigns the arguments to the appropriate properties. Methods (10 points]: 1. public override string ToString() - This method overrides the same method of the object class. It does not take any parameter but return a string representation of itself. You decide on the format for the output. 2. public static TikTok Parse(string line) - This is a public class method that takes a string argument and returns a TikTok object. It is used to create a TikTok object when loading the TikToks from a file. The argument represents a single line of input read from the file. This method does the following: a. 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 for the Split() method use Actis the following code: Split('It'); Go to b. Invokes the five arguments constructor. Because all the arguments are string, it is easy to inter-change the order. You need to examine 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 C. The TikTokManager 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: $ TikTokManager Static Class Fields - $ TIKTOKS - $FILENAME : List
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