using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.IO;namespace ConsoleApplication1{ class Program { static void Main(string[] args) { public void StartTask2() { try { using (StreamReader reader = new StreamReader("MyTestFile.txt")) { ProcessFile(reader); DisplayRelativeFrequence(); } } catch (IOException ex) { Console.WriteLine("Error, StreamReader failed with error {0}", ex.Message); } }private void ProcessFile(StreamReader reader) { char tecken; int index; foreach (char ch in reader.ReadToEnd()) { if (Char.IsLetter(ch)) { totalCount++; tecken = Char.ToLower(ch); index = tecken - 97; //index starting with 0 for a and last index for ö switch (tecken) { case 'å': array[array.Length - 3]++; break; case 'ä': array[array.Length - 2]++; break; case 'ö': array[array.Length - 1]++; break; default: array[index]++; break; } } } }private void DisplayRelativeFrequence() { for (char ch = 'a'; ch <= 'z'; ch++) Console.WriteLine("The relative frequency for letter = {0} is {1:F3}", ch, (double)array[ch - 97] / totalCount); //Check reelative frequency for åäö Console.WriteLine("The relative frequency for letter = å is {0:F3}", (double)array[array.Length - 3] / totalCount); Console.WriteLine("The relative frequency for letter = ä is {0:F3}", (double)array[array.Length - 2] / totalCount); Console.WriteLine("The relative frequency for letter = ö is {0:F3}", (double)array[array.Length - 1] / totalCount); } } }}