Question: 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 (5marks] 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 Activa 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 : int -$ _ID Properties + Originator + Length + HashTag + Audience + Id : string : int : string : Audience : string Activa 4 to se 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 and you must use the type to access that member. Acti 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) Activate C. 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: 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 Activate the following code: Split('It'); Go to Seti 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 : string Methods $ TikTokManager() +$ Initialize() : void +$ Show() : void +$ Show(hashtag: string) : void +$ Show(length : int) : void +$ Show( audience : Audience) : void ALL MEMBERS ARE STATIC! Fields (15 points): 1. TIKTOKS - this private field is a class variable; it is a collection of all the tiktoks in the system. It is initialized and populated in the static constructor. 2. FILENAME - this private field is a class variable; it represents the name of the file that contains all the tiktoks. It is used in the static constructor to read in the tiktoks. You will have to set this to the name of file that has the information about the tiktoks. A static constructor does not take any arguments, nor does it require any Constructor: accessibility modifier. Infact specifying one 1. static TikTokManager() - This is the will raise a compiler error static constructor. It does not require any It is called before any member is accessed parameter. This constructor does the and never ever again. following: a. Initialize the TIKTOKS field to a new list of tiktok b. Opens the file specified by the filename field for reading Using a looping structure it does the following: i. Reads one line from the file. ii. Passes this line to the static Parse() method of the TikTok class to create a Activate Windows tiktok object. Go to Settings to act Vate Windo C. a. b. C. Initialize the TIKTOKS field to a new list of tiktok Opens the file specified by the filename field for reading Using a looping structure it does the following: i. Reads one line from the file. ii. Passes this line to the static Parse() method of the TikTok class to create a tiktok object. iii. The resulting object is added to the tiktok collection. iv. This is repeated until the input from the file is empty (null). Methods : 1. public static void Initialize() - This class method it used to facilitate the development of this project. It will not be used in the production This will be used to test your code in the event you cannot figure out the file reading part. code, just while developing. This method does the following: a. Assigns the TIKOKS field b. Creates about 5 tiktoks objects and add them to the tiktok collection. 2. public static void Show() - This is a public class method that does not take any argument This is good example of method that does not return a value. It displays all the overloading, i.e. methods with the same name. tiktoks in the collection. 3. public static void Show(string tag) - This is a public class method that takes a string argument that does not return a value. It displays all the tiktoks with hashTag matching the argument. This comparison must be case in-sensitive. 4. public static void Show(int length) - This is a public class method that takes an int argument that does not return a value. It displays all the tiktoks with length greater than the argument. 5. public static void Show(Audience audience) - This is a public class method that takes an int argument that does not return a value. It displays all the tiktoks with audience matching the argument. Testing (10 points] In your test harness (the Main() method in the Program Class), write the code to test all the methods of the TikTokManager class including the Initialize() method. When testing with the supplied file copy the file to bin\Debug folder. tiktoks - Notepad File Edit Format View Help 500000 abhi 20 group covid 500001 sameer 19 group covid 500002 joan 24 group summer heat 500003 ajay 15 world bars 500004 carl 21 world park 500005 hema 22 special park 500006 jerry 20 group bars 500007 jen 20 world covid 500008 abi 14 group park 500009 dave 19 special summer 500010 fred 16 group covid 500011 dave 24 group summer heat 500012 abby 20 world bars 500013 prataap 21 world park 500014 brad 18 special park 500015 rahul 19 group bars 500016 abhi 17 world covid 500017 suresh 19 group covid 500018 shivani 24 group summer heat 500019 abram 15 world bars 500020 chandra 21 world park 500021 rishi 22 special park 500022 ranbir 20 group bars 500023 vinod 20 world covid 500024 rahul 14 group park 500025 bindu 19 special summer 500026 yasmin 16 group covid 500027 preeti 24 group summer heat 500028 sanjay 20 world bars 500029 hema 21 world park 500030 rishi 18 special park 500031 joan 24 group summer heat 500032 ajay 15 world bars 500033 abhi 21 world social distancing 500034 shivani 22 special park 500034 shivani 22 500035 jerry 20 500036 jen 20 500037 abi 14 500038 dave 19 500039 fred 16 500040 ajay 24 500041 abby 20 500042 prataap 21 500043 brad 18 500044 rahul 19 500045 abhi 17 500046 suresh 19 500047 shivani 24 500048 abram 15 500049 ranbir 21 500050 rishi 22 special park group covid world covid group park special music group covid group concert world bars world toronto special park group college world covid group Summer group summer heat world bars world park special covid Use C# Console App (.NET Framework) C#
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts







![Tiktok.cs file. The Audience Enum (5marks] This enum specifies the intended audience](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66f52582435e2_95366f52581d738d.jpg)







