// perform a binary search on array public static void BinarySearch(string[,] Data, string searchElement, int position, int First, int Second, int size) //call this one!!!!!!!!!!!!!!! { int OperationCount1 = 0; //counts the number of operations int OperationCount = 0; //counts the number of operations Class1.ChangeMonthsToInt(ref Data, size, 1); //chanages months to integers HeapSortSortDataFiles hs = new HeapSortSortDataFiles(); //calls a new object hs.PerformHeapSort(ref Data, position, size, ref OperationCount1); //sorts the given array based off of what the user is searching makes searches (best case) int low = 0; // 0 is always going to be the first element int high = size - 1; // Find highest element int middle = (low + high + 1) / 2; // Find middle element int location = -1; // Return value -1 if not found do //Search for element { if (searchElement == Data[position, middle]) //checks the users search against all elements in the array { //once one element is found First = middle; Second = middle; //used for months if (position == 1) { //finds the uperbound, goes back up array from the postion where the search has found a criteria to see if any more are found for (int i = middle - 1; i >= 0; i--) { if (searchElement == Data[position, i].Replace(" ", "")) { //OperationCount =i;//counts operations First = i; } else { //OperationCount++;//counts operations i = -1; } } //finds the uperbound, goes down array from the postion where the search has found a criteria to see if any more are found for (int i = middle + 1; i < size; i++) { if (searchElement == Data[position, i].Replace(" ", "")) { //OperationCount++;//counts operations Second = i; } else { //OperationCount++;//counts operations i = size; } } } //used for all other files else { //finds the uperbound, goes back up array from the postion where the search has found a criteria to see if any more are found for (int i = middle - 1; i >= 0; i--) { if (searchElement == Data[position, i].Replace(",", "")) { //OperationCount++;//counts operations First = i; } } //finds the uperbound, goes down array from the postion where the search has found a criteria to see if any more are found for (int i = middle + 1; i < size; i++) { if (searchElement == Data[position, i].Replace(",", "")) { //OperationCount++;//counts operations Second = i; } } } location = middle; // location is current middle } // middle element is too high //if the file being searched is not region do this else if (position != 8) { if (Convert.ToDouble(searchElement.Replace(":", "")) < Convert.ToDouble(Data[position, middle].Replace(":", ""))) //all other elements can be converted to doubles for comparision { high = middle - 1; // eliminate lower half //OperationCount++; } else // middle element is too low { low = middle + 1; // eleminate lower half //OperationCount++; } } //below is for region else { if (0 > (searchElement.Replace(",", "").CompareTo(Data[position, middle].Replace(",", "")))) //compare to checks the values to see which is greater { high = middle - 1; // eliminate lower half } else // middle element is too low { low = middle + 1; // eleminate lower half } } middle = (low + high + 1) / 2; // recalculate the middle OperationCount++; } while ((low <= high) && (location == -1)); int SizeofTemp; int FirstLoopIncrement; //no data was found error if (Second == -1 && First == -1) { Console.WriteLine("ERRRO!! NO DATA WAS FOUND"); Console.ReadLine(); } //if data was found else { //calculate the temp arrays length for storeing all data found and how many times the below loops needs to loop if (Second == First) { FirstLoopIncrement = Second + 1; SizeofTemp = 1; } else { FirstLoopIncrement = Second + 1; SizeofTemp = (Second - First) + 1; } OperationCount = OperationCount + SizeofTemp; //new array used for holding all data found in main array string[,] TempHolder = new string[11, SizeofTemp]; Class1.ChangeIntToMonth(ref Data, 1200); //changes ints back to months //loops through assigning the new array array with the values found in main for (int i = First; i < FirstLoopIncrement; i++) { for (int y = 0; y < 11; y++) { TempHolder[y, i - First] = Data[y, (i)]; } } Console.Clear(); Class1.SendToHTML(TempHolder, (Second - First) + 1); //array send to .HTML file for output Console.ReadLine(); } //outputs the number of operations needed to complete search Console.WriteLine("In this Binary Search, there were {0} Main operations!", OperationCount); Console.ReadLine(); }
//Linear Search public static void SearchLinear(string[,] FileHolder, string SearchItem, int position, int size) { int OperationCount1 = 0; int OperationCount = 0; Class1.ChangeMonthsToInt(ref FileHolder, size, 1); // changes months to ints HeapSortSortDataFiles hs = new HeapSortSortDataFiles(); //new object hs.PerformHeapSort(ref FileHolder, position, size, ref OperationCount1); // sorts array based on the position with is being searched Class1.ChangeIntToMonth(ref FileHolder, size); // change ints to months int First = -1; int Second = 0; //checks search item against element //finds uper and lower bound to work out temp array size for (int i = 0; i < size; i++) { //position is equal to months if (position == 1) { if (SearchItem == FileHolder[position, i].Replace(" ", ""))//checks search item against element { if (First == -1) { //OperationCount++; //increments operation count First = i; } } } //position is any of the other files else { if (SearchItem == FileHolder[position, i])//checks search item against element { if (First == -1) { //OperationCount++; //increments operation count First = i; } } } if (SearchItem != FileHolder[position, i] && First >= 0) { //OperationCount++; //increments operation count Second = i - 1; i = size; // closes for loop } OperationCount++; //increments operation count //Console.WriteLine(OperationCount); //Console.ReadLine(); } //no data found based on search criteria if (First == -1 && Second == 0) { Console.WriteLine("ERRRO!! NO DATA WAS FOUND"); Console.ReadLine(); } else { if ((Second < First) && Second == 0) { Second = 1199; } string[,] TempHolder = new string[11, (Second - First) + 1]; // temp array storage for web output //assigns the temp array with data found off of search for (int i = First; i < Second + 1; i++) { for (int y = 0; y < 11; y++) { TempHolder[y, i - First] = FileHolder[y, i]; } } Class1.SendToHTML(TempHolder, (Second - First) + 1); // outputs to .HTML //outputs the number of operations for the search Console.WriteLine("In this Linear Search, there were {0} Main operations!", OperationCount); Console.ReadLine(); } }
//Sorts in Ascending or Descending Order public static void AsendingDesendingOrder(ref string[,] FileHolder1, int size, int SortChoice, ref bool Menu3) { string[] FilePaths = Class1.SortArrayBubble(); // assigns array all file paths from folder bool ExitFirstWhile = false; // used for first whils loop bool TF2 = false; // used for two while loop bool TF3 = false; //used for thrid while loop int PositionToOrder = -1; while (ExitFirstWhile == false) { //output all files avaliable for sorting Console.Clear(); Console.WriteLine("Below Shows all Avaliable file Titles: "); for (int i = 0; i < 11; i++) { FilePaths[i] = Regex.Replace(Path.GetFileNameWithoutExtension(FilePaths[i]), @"[\d-]", string.Empty).Replace("_", "");// displays the file names for user to chose from Console.WriteLine(FilePaths[i]); } Console.WriteLine("Please Enter the File you Wish to sort: "); string UserChoice = Console.ReadLine();// user input data bool EnterCorrect = false; for (int i = 0; i < 11; i++) { if (UserChoice == FilePaths[i]) // checks if the user has input a valid file path name { EnterCorrect = true; PositionToOrder = i; } } try { if (EnterCorrect == true) { while (TF2 == false) { Console.WriteLine(""); Console.WriteLine("Please Enter A for ascending or D for Descending: "); char UserInput; try { //checks the following statements for errors UserInput = Convert.ToChar(Console.ReadLine()); if ((UserInput == 'd' || UserInput == 'D' || UserInput == 'a' || UserInput == 'A')) //checks the user entered a valid letter for either choice Descending or Ascending { int Choice = -1; if (UserInput == 'd' || UserInput == 'D') //Descending { Choice = 0; //Descending = 0 if (SortChoice == 1) //bubble sort { BubbleSort.SortBubble(ref FileHolder1, size, PositionToOrder); //bubble sorts the array given Class1.SendToHTML(FileHolder1, size); //outputs to .HTML file } else if (SortChoice == 2) //heap sort { int OperationCount = 0; HeapSortSortDataFiles hs = new HeapSortSortDataFiles(); Class1.ChangeMonthsToInt(ref FileHolder1, size, 1); //changes months to ints hs.PerformHeapSort(ref FileHolder1, PositionToOrder, size, ref OperationCount); //performs a heap sort Class1.ChangeIntToMonth(ref FileHolder1, size); // changes int to months Class1.SwapValues(ref FileHolder1, size); // swaps values for descending Class1.SendToHTML(FileHolder1, size); //outputs to .HTML file //outputs the number of operations takesn for the sort Console.WriteLine("In this Heap sort, there were {0} operations in changing data!", OperationCount); Console.ReadLine(); } } else if (UserInput == 'a' || UserInput == 'A') //Ascending { Choice = 1; //Descending = 0 if (SortChoice == 1) //bubble sort { BubbleSort.SortBubble(ref FileHolder1, size, PositionToOrder); //bubble sorts the array given Class1.SwapValues(ref FileHolder1, size); //swaps values becuase descending was chose Class1.SendToHTML(FileHolder1, size); //outputs to .HTML file } else if (SortChoice == 2) //heap sort { int OperationCount = 0; HeapSortSortDataFiles hs = new HeapSortSortDataFiles(); Class1.ChangeMonthsToInt(ref FileHolder1, size, 1); //changes months to ints hs.PerformHeapSort(ref FileHolder1, PositionToOrder, size, ref OperationCount); //performs a heap sort Class1.ChangeIntToMonth(ref FileHolder1, size); // changes int to months Class1.SendToHTML(FileHolder1, size); //outputs to .HTML file //outputs the number of operations takesn for the sort Console.WriteLine("In this Heap sort, there were {0} operations in changing data!", OperationCount); Console.ReadLine(); } } } TF2 = true; } catch (System.FormatException e)//Exception handling { Console.WriteLine("Exception caught: {0}", e); Console.WriteLine(); } } while (TF3 == false) { Console.WriteLine("Would you like to sort another file? Enter Y/N "); string UserExitInput; try { //checks user input UserExitInput = Console.ReadLine(); if (UserExitInput == "y" || UserExitInput == "Y") //checks if user enter YES { TF3 = true; TF2 = true; ExitFirstWhile = true; } //if they didnt enter YES else { TF3 = true; TF2 = true; ExitFirstWhile = true; Menu3 = true; } } catch (System.FormatException e)//Exception handling { Console.WriteLine("Exception caught: {0}", e); Console.WriteLine(); } } } } catch (System.FormatException e) //Exception handling { Console.WriteLine("Exception caught: {0}", e); Console.WriteLine(); } Class1.WriteToFile(FileHolder1, size); //writes to .CSV file } }
static void Main(string[] args) { //Defines and Asigns the Values inside the text files to a 2d array //////////////////////////////////////////////////////////////////// string[,] FileHolder1 = new string[11, 1200]; //Used to Store the Merged Data Sets Class1.ReadFile(ref FileHolder1, 0); string[,] FileHolder2 = new string[11, 600]; //Used to Store Data Set 2 Class1.ReadFile(ref FileHolder2, 11); string[,] FileHolder3 = new string[11, 600]; //Used to Store Data Set 1 Class1.ReadFile(ref FileHolder3, 0); Class1.AddBothSets(ref FileHolder1, FileHolder2); //Used to Merge the two Data Sets /////////////// //Sorts All Three 2D Arrays into TimeStamp Sort HeapSortSortDataFiles hs = new HeapSortSortDataFiles(); int CountOperations = 0; //The 2 Merged Data Sets hs.PerformHeapSort(ref FileHolder1, 10, 1200, ref CountOperations); Class1.SwapValues(ref FileHolder1, 1200); //Data Set 2 hs.PerformHeapSort(ref FileHolder2, 10, 600, ref CountOperations); Class1.SwapValues(ref FileHolder2, 600); //Data Set 1 hs.PerformHeapSort(ref FileHolder3, 10, 600, ref CountOperations); Class1.SwapValues(ref FileHolder3, 600); //Applications Main Menu System bool Menu1 = false; //Bool check for the first While loop while (Menu1 == false) { //first Menu for user. //they chose the data set they wish to analyse Console.Clear(); int UserInput1; Console.WriteLine("Analysing Data:"); Console.WriteLine(" ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾"); Console.WriteLine("Enter the number 1 to Analyse Data Set 1: "); Console.WriteLine(" ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾"); Console.WriteLine("Enter the number 2 to Analyse Data Set 2: "); Console.WriteLine(" ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾"); Console.WriteLine("Enter the number 3 to Analyse Both Data Sets Together: "); Console.WriteLine(" ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾"); Console.WriteLine("Please enter a Number from the choices layed out above: "); Console.WriteLine(" ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾"); try { UserInput1 = Convert.ToInt32(Console.ReadLine()); //stores the users choice //Second tier Menu bool Menu2 = false; //Bool check for the Second While loop while (Menu2 == false) { //Verifies that the correct Data has been enter (1, 2 or 3) if (UserInput1 == 1 || UserInput1 == 2 || UserInput1 == 3) { //Second menus for user to choice which task Console.Clear(); int UserInput2; Console.WriteLine("Enter the number 1 to sort the data into an ascending or Descending order!"); Console.WriteLine(" ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ "); Console.WriteLine("Enter the number 2 search using all data files!"); Console.WriteLine(" ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾"); Console.WriteLine("Enter the number 3 to search for data based on the month!"); Console.WriteLine(" ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾"); Console.WriteLine("Enter the number 4 to find the minimum and maximum Values for each file!"); Console.WriteLine(" ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾"); Console.WriteLine("Enter the number 5 to Search for specific Data in Individual Files!"); Console.WriteLine(" ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ "); Console.WriteLine("Enter the number 6 to output the Data Set you've choosen to Analyse!"); Console.WriteLine(" ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ "); Console.WriteLine("Enter the number 7 to Chose Another Data Set!"); Console.WriteLine(" ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ "); Console.WriteLine("Enter the number 8 to quit the application!"); Console.WriteLine(" ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ ‾ "); try { UserInput2 = Convert.ToInt32(Console.ReadLine()); //stores the users choice //Switch Statement Based off of Users choice from the above Displayed switch (UserInput2) { //Descending Or Ascending case 1: //1: Uses Data Set 1 if (UserInput1 == 1) { //Third tier Menu bool Menu3 = false; //Bool check for the Third tier loop while (Menu3 == false) { //Offers user choice on sort method Console.Clear(); int UserInput3; Console.WriteLine("Sorts Avaliable: "); Console.WriteLine("1: Bubble "); Console.WriteLine("2: Heap "); Console.WriteLine("Please Enter 1 or 2"); try { UserInput3 = Convert.ToInt32(Console.ReadLine()); //stores the users choice Task2_AscendingDescendingOrder.AsendingDesendingOrder(ref FileHolder3, 600, UserInput3, ref Menu3); //used for Acsending/Descending order } catch (System.FormatException e) //exception handling { Console.Clear(); Console.WriteLine("Exception caught: {0}", e); Console.WriteLine(); } } } //2: Uses Data Set 2 else if (UserInput1 == 2) { //Third tier Menu bool Menu3 = false; //Bool check for the Third tier loop while (Menu3 == false) { //Offers user choice on sort method Console.Clear(); int UserInput3; Console.WriteLine("Sorts Avaliable: "); Console.WriteLine("1: Bubble "); Console.WriteLine("2: Heap "); try { UserInput3 = Convert.ToInt32(Console.ReadLine()); //stores the users choice Task2_AscendingDescendingOrder.AsendingDesendingOrder(ref FileHolder2, 600, UserInput3, ref Menu3); //used for Acsending/Descending order } catch (System.FormatException e) //exception handling { Console.Clear(); Console.WriteLine("Exception caught: {0}", e); Console.WriteLine(); } } } //3: Uses Merged Data else if (UserInput1 == 3) { //Third tier Menu bool Menu3 = false; //Bool check for the Third tier loop while (Menu3 == false) { //Offers user choice on sort method Console.Clear(); int UserInput3; Console.WriteLine("Sorts Avaliable: "); Console.WriteLine("1: Bubble "); Console.WriteLine("2: Heap "); try { UserInput3 = Convert.ToInt32(Console.ReadLine()); //stores the users choice Task2_AscendingDescendingOrder.AsendingDesendingOrder(ref FileHolder1, 1200, UserInput3, ref Menu3); //used for Acsending/Descending order } catch (System.FormatException e) //exception handling { Console.Clear(); Console.WriteLine("Exception caught: {0}", e); Console.WriteLine(); } } } break; case 2: //1: Uses Data Set 1 if (UserInput1 == 1) { Console.Clear(); Task3_SearchAllData.LinearSearch(FileHolder3, 600); //used for search the given data set for a specific peice of data. using all file elements Class1.SendToHTML(FileHolder3, 600); //Sends an array to .HTML file } //2: Uses Data Set 2 else if (UserInput1 == 2) { Console.Clear(); Task3_SearchAllData.LinearSearch(FileHolder2, 600); //used for search the given data set for a specific peice of data. using all file elements Class1.SendToHTML(FileHolder2, 600); //Sends an array to .HTML file } //3: Uses Merged Data else if (UserInput1 == 3) { Console.Clear(); Task3_SearchAllData.LinearSearch(FileHolder1, 1200); //used for search the given data set for a specific peice of data. using all file elements Class1.SendToHTML(FileHolder1, 1200); //Sends an array to .HTML file } break; case 3: //1: Uses Data Set 1 if (UserInput1 == 1) { bool Menu3 = false; //Bool check for the Third tier loop while (Menu3 == false) { //offers user a choice of search method Console.Clear(); int UserInput3; Console.WriteLine("Sorts Avaliable: "); Console.WriteLine("1: Binary "); Console.WriteLine("2: Linear "); try { //trys the below UserIntput3 for errors UserInput3 = Convert.ToInt32(Console.ReadLine()); //stores the users choice Task4_SearchMonth.SearchMonth(FileHolder3, 600, UserInput3); //searches month for a specific month Menu3 = true; } catch (System.FormatException e) //exception handling { Console.Clear(); Console.WriteLine("Exception caught: {0}", e); Console.WriteLine(); } } } //2: Uses Data Set 2 else if (UserInput1 == 2) { bool Menu3 = false; //Bool check for the Third tier loop while (Menu3 == false) { //offers user a choice of search method Console.Clear(); int UserInput3; Console.WriteLine("Sorts Avaliable: "); Console.WriteLine("1: Binary "); Console.WriteLine("2: Linear "); try { //trys the below UserIntput3 for errors UserInput3 = Convert.ToInt32(Console.ReadLine()); //stores the users choice Task4_SearchMonth.SearchMonth(FileHolder2, 600, UserInput3); //searches month for a specific month } catch (System.FormatException e) //exception handling { Console.Clear(); Console.WriteLine("Exception caught: {0}", e); Console.WriteLine(); } } } //3: Uses Merged Data else if (UserInput1 == 3) { bool Menu3 = false; //Bool check for the Third tier loop while (Menu3 == false) { //trys the below UserIntput3 for errors //offers user a choice of search method Console.Clear(); int UserInput3; Console.WriteLine("Sorts Avaliable: "); Console.WriteLine("1: Binary "); Console.WriteLine("2: Linear "); try { UserInput3 = Convert.ToInt32(Console.ReadLine()); //stores the users choice Task4_SearchMonth.SearchMonth(FileHolder1, 1200, UserInput3); //searches month for a specific month } catch (System.FormatException e) //exception handling { Console.Clear(); Console.WriteLine("Exception caught: {0}", e); Console.WriteLine(); } } } break; case 4: //1: Uses Data Set 1 if (UserInput1 == 1) { Console.Clear(); Console.WriteLine("Maximum For each File:"); Task5_FindMinMaxVals.FindMaxData(FileHolder3, 600); //Finds the Max values in an array Console.ReadLine(); Console.WriteLine("Minimum For each File:"); Task5_FindMinMaxVals.FindMinData(FileHolder3, 600); //Finds the Min values in an array Console.ReadLine(); } //2: Uses Data Set 2 else if (UserInput1 == 2) { Console.Clear(); Task5_FindMinMaxVals.FindMaxData(FileHolder2, 600); //Finds the Max values in an array Task5_FindMinMaxVals.FindMinData(FileHolder2, 600); //Finds the Min values in an array //Class1.SendToHTML(FileHolder2, 600); //Sends an array to .HTML file } //3: Uses Merged Data else if (UserInput1 == 3) { Console.Clear(); Task5_FindMinMaxVals.FindMaxData(FileHolder1, 1200); //Finds the Max values in an array Console.WriteLine("HELLO"); Console.ReadLine(); Task5_FindMinMaxVals.FindMinData(FileHolder1, 1200); //Finds the Min values in an array //Class1.SendToHTML(FileHolder1, 1200); //Sends an array to .HTML file Console.WriteLine("HELLO"); Console.ReadLine(); } break; case 5: { int SortChoice = -1; //1: Uses Data Set 1 if (UserInput1 == 1) { //Third tier Menu bool Menu3 = false; //Bool check for the Third tier loop while (Menu3 == false) { //offers user a choice of search method Console.Clear(); Console.WriteLine("Searches Avaliable: "); Console.WriteLine("1: Binary "); Console.WriteLine("2: Linear "); Console.WriteLine("Please Enter 1 or 2"); try { //trys the below UserIntput3 for errors SortChoice = Convert.ToInt32(Console.ReadLine()); //stores the users choice Task6_SearchForIndividualData.SearchingIndividual(FileHolder3, 600, SortChoice, ref Menu3); //searchs a give file for all the data according to the search Class1.SendToHTML(FileHolder3, 600); //Sends an array to .HTML file } catch (System.FormatException e) //exception handling { Console.Clear(); Console.WriteLine("Exception caught: {0}", e); Console.WriteLine(); } } } //2: Uses Data Set 2 else if (UserInput1 == 2) { //Third tier Menu bool Menu3 = false; //Bool check for the Third tier loop while (Menu3 == false) { //offers user a choice of search method Console.Clear(); Console.WriteLine("Searches Avaliable: "); Console.WriteLine("1: Binary "); Console.WriteLine("2: Linear "); Console.WriteLine("Please Enter 1 or 2"); try { //trys the below UserIntput3 for errors SortChoice = Convert.ToInt32(Console.ReadLine()); //stores the users choice Task6_SearchForIndividualData.SearchingIndividual(FileHolder2, 600, SortChoice, ref Menu3); //searchs a give file for all the data according to the search Class1.SendToHTML(FileHolder2, 600); //Sends an array to .HTML file } catch (System.FormatException e) //exception handling { Console.Clear(); Console.WriteLine("Exception caught: {0}", e); Console.WriteLine(); } } } //3: Uses Merged Data else if (UserInput1 == 3) { //Third tier Menu bool Menu3 = false; //Bool check for the Third tier loop while (Menu3 == false) { //offers user a choice of search method Console.Clear(); Console.WriteLine("Searches Avaliable: "); Console.WriteLine("1: Binary "); Console.WriteLine("2: Linear "); Console.WriteLine("Please Enter 1 or 2"); try { //trys the below UserIntput3 for errors SortChoice = Convert.ToInt32(Console.ReadLine()); //stores the users choice Task6_SearchForIndividualData.SearchingIndividual(FileHolder1, 1200, SortChoice, ref Menu3); //searchs a give file for all the data according to the search Class1.SendToHTML(FileHolder2, 600); //Sends an array to .HTML file } catch (System.FormatException e) //exception handling { Console.Clear(); Console.WriteLine("Exception caught: {0}", e); Console.WriteLine(); } } } } break; case 6: //1: Uses Data Set 1 if (UserInput1 == 1) { Console.Clear(); Class1.SendToHTML(FileHolder3, 600); //Sends an array to .HTML file } //2: Uses Data Set 2 else if (UserInput1 == 2) { Console.Clear(); Class1.SendToHTML(FileHolder2, 600); //Sends an array to .HTML file } //3: Uses Merged Data else if (UserInput1 == 3) { Console.Clear(); Class1.SendToHTML(FileHolder1, 1200); //Sends an array to .HTML file } break; case 7: Menu2 = true; //Excits the second tier of menu system break; case 8: Menu2 = true; //Excits entire program Menu1 = true; break; default: break; } } catch (System.FormatException e) //exception handling { Console.Clear(); Console.WriteLine("Exception caught: {0}", e); Console.WriteLine(); } } else { Menu2 = false; } } } catch (System.FormatException e) //exception handling { Console.Clear(); Console.WriteLine("Exception caught: {0}", e); Console.WriteLine(); } } }