private int textLoop = 1; //holds value for input loop public void UserTextEntry(string filePath) { string pFilePath = filePath; textLoop = 1; //sets text loop back to 1 userText = ""; text = ""; Console.WriteLine("\nYou have chosen option 1.\nPlease input you text and finish your last sentence with *"); //output to the user while (textLoop <= 1) //loop executed if loop is less than or equal to 1 { text = Console.ReadLine(); //takes in users input ans stores in text variable userText += (" " + text); //adds users input to the final usersText variable foreach (char c in userText) //executed for each character of the users input { if (c == '*') //executed if the character is a * { textLoop = textLoop + 1; //adds 1 to the text loop stopping it from executing } } } textAn.vowelCount(userText); //calls vowel count method from analysis and passes users text textAn.ConsonantCount(userText); //calls consonant count method from analysis and passes users text textAn.LowerCount(userText); //calls vowel lower case method from analysis and passes users text textAn.UpperCount(userText); //calls upper case count method from analysis and passes users text textAn.SentenceCount(userText); //calls sentence count method from analysis and passes users text textAn.Letterfrequency(userText); //calls letter frequency method from analysis object and passes users text wtd.LongWords(userText, pFilePath); //calls LongWords method from wtd object and passes users text }
private string text = File.ReadAllText(file); //reads text file into program #endregion Fields #region Methods public void TextFile(string filePath) { string pFilePath = filePath; Analysis txtAn = new Analysis(); //creates a new object of analysis WriteToDoc wtd = new WriteToDoc(); Console.WriteLine("{0}", text); //outputs text file to the console //Calls all analysis methods passing text to each txtAn.vowelCount(text); txtAn.ConsonantCount(text); txtAn.LowerCount(text); txtAn.UpperCount(text); txtAn.SentenceCount(text); txtAn.Letterfrequency(text); wtd.LongWords(text, pFilePath); }
private string text = File.ReadAllText(file); //reads text file into program public void TextFile(string filePath) { string pFilePath = filePath; Analysis txtAn = new Analysis(); //creates a new object of analysis WriteToDoc wtd = new WriteToDoc(); Console.WriteLine("{0}", text); //outputs text file to the console //Calls all analysis methods passing text to each txtAn.vowelCount(text); txtAn.ConsonantCount(text); txtAn.LowerCount(text); txtAn.UpperCount(text); txtAn.SentenceCount(text); txtAn.Letterfrequency(text); wtd.LongWords(text, pFilePath); }