示例#1
0
文件: Lab1.cs 项目: CarambulaGit/MOPE
        private static void Main(string[] args)
        {
            var stopwatch = new Stopwatch();

            stopwatch.Start();
            var sol = new Lab1(new float[3][], 1, 2, 3, 4, 0, 20);

            sol.RunExperiment().ToArray().Print(true);
            stopwatch.Stop();
            Console.WriteLine();
            sol.experiments.Print(true);
            Console.WriteLine();
            new[] { sol.yArr }.Print(true);
            Console.WriteLine();
            sol.experimentsNormalized.Print(true);
            Console.WriteLine($"\nExperiment time = {stopwatch.ElapsedMilliseconds} ms");
        }
示例#2
0
 /// <summary>
 /// Display Employees List in descending order by Gross Payment.
 /// </summary>
 /// <param name="employeesList"></param>
 private void DisplayByGrossPayment(Employee[] employeesList)
 {
     Lab1.Sort(employeesList, 5);
     DisplayEmployees(employeesList);
 }
示例#3
0
 /// <summary>
 /// Display Employees List in descending order by Hours Worked.
 /// </summary>
 /// <param name="employeesList"></param>
 private void DisplayByHours(Employee[] employeesList)
 {
     Lab1.Sort(employeesList, 4);
     DisplayEmployees(employeesList);
 }
示例#4
0
 /// <summary>
 /// Display Employees List in descending order by Pay Rate.
 /// </summary>
 /// <param name="employeesList"></param>
 private void DisplayByPayRate(Employee[] employeesList)
 {
     Lab1.Sort(employeesList, 3);
     DisplayEmployees(employeesList);
 }
示例#5
0
 /// <summary>
 /// Display Employees List in ascending order by ID Number.
 /// </summary>
 /// <param name="employeesList"></param>
 private void DisplayByNumber(Employee[] employeesList)
 {
     Lab1.Sort(employeesList, 2);
     DisplayEmployees(employeesList);
 }
示例#6
0
 /// <summary>
 /// Display Employees List in ascending order by Name.
 /// </summary>
 /// <param name="employees">Array list of Employees</param>
 private void DisplayByName(Employee[] employeesList)
 {
     Lab1.Sort(employeesList, 1);
     DisplayEmployees(employeesList);
 }
示例#7
0
        /// <summary>
        /// Most functionality resides in this class, reading, sorting and output format are all contained within methods and called in the main class
        /// </summary>
        /// <param name="args"></param>
        static void Main(string[] args)
        {
            ComicBook[] comicBookCollection;
            int         num;

            Lab1.Read(out comicBookCollection, out num);
            bool moreFunctions = true;

            while (moreFunctions)                             //If the user enters '7' the flag will be set to false and the program will quit.
            {
                string choice = menu();                       //set sort selection to the return string from menu, request input and display menu
                int    choiceParsed;
                if (Int32.TryParse(choice, out choiceParsed)) //convert the string to an integer, check for appropriate input
                {
                    switch (choiceParsed)
                    {
                    case 1:
                        selectionSort(comicBookCollection, num, choiceParsed);
                        break;

                    case 2:
                        selectionSort(comicBookCollection, num, choiceParsed);
                        break;

                    case 3:
                        selectionSort(comicBookCollection, num, choiceParsed);
                        break;

                    case 4:
                        selectionSort(comicBookCollection, num, choiceParsed);
                        break;

                    case 5:
                        selectionSort(comicBookCollection, num, choiceParsed);
                        break;

                    case 6:
                        selectionSort(comicBookCollection, num, choiceParsed);
                        break;

                    case 7:
                        moreFunctions = false;
                        break;

                    default:
                        Console.WriteLine("");
                        Console.WriteLine("Invalid choice, please try again.");
                        Console.WriteLine("");
                        break;
                    }
                    if (choiceParsed >= 1 && choiceParsed <= 6)
                    {
                        Console.Clear();
                        DisplayComicTable(comicBookCollection, num);
                    }
                }

                else
                {
                    Console.WriteLine("");
                    Console.WriteLine("Invalid choice, please try again.");
                    Console.WriteLine("");
                }
            }
        }