//Establishes a StreamReader, Random Number, UserInterface. //Establishes the WineItem & WineItemCollection class arrays bases on the size of the input file. //Reads the input file into the WineItem array. //Directs the program based on user input. static void Main(string[] args) { StreamReader wineList = new StreamReader("../../../datafiles/WineList.csv"); Random randomNumber = new Random(); UserInterface ui = new UserInterface(); Int32 arrayCount = CSVProcessor.Processor(wineList); Int32 addToArrayCount = arrayCount; WineItem[] wineItems = new WineItem[arrayCount + 5]; WineItemCollection[] collections = new WineItemCollection[arrayCount + 5]; CSVProcessor.ReadFile(wineItems, wineList); Int32 selection1_Int32 = 0; //While the user has not chosen to exit the program. while (selection1_Int32 != 5) { selection1_Int32 = ui.InputMenu1(); String output; switch (selection1_Int32) { //Displays the output as found in the input file. //This will display the array in a sorted order if it has already been sorted (if choice 2 or 3 has already been selected). case 1: { output = WineItem.CreateString(wineItems); ui.PrintAllOutput(output); break; } //Displays the output in ascending or descending order with item location. case 2: { Int32 selection2_Int32 = 0; selection2_Int32 = ui.InputMenu2(); WineItemCollection.SetLocation(wineItems, collections, randomNumber); output = WineItem.CreateLongString(wineItems, collections, selection2_Int32); ui.PrintAllOutput(output); selection2_Int32 = 0; break; } //Prompts the user for input and searches the file for matching items. //Prompts the user for a search method as well. //Dispays a message for successful and unsuccessful searches. case 3: { Int32 foundLocation = -1; String temp = ui.SearchId(); Int32 selection3_Int32 = ui.InputMenu3(); foundLocation = WineItem.SearchType(wineItems, temp, selection3_Int32, arrayCount); if (foundLocation == -1) { ui.NotFound(temp); } break; } //Allows the user to add items to the wine directory (up to 5 items). case 4: { addToArrayCount = ui.UserAddWine(wineItems, addToArrayCount); //addToArrayCount++; break; } //Exit loop selection case 5: { //Do Nothing - proceed to close the program. break; } } } }