static public void runChoice(string choice, string userword, string key)
 {
     if (choice == "encode")
     {
         string encoded = Exercise10.encode(userword, key);
         Console.WriteLine("Your encoded string is: {0}", encoded);
     }
     else if (choice == "decode")
     {
         string decoded = Exercise10.decode(userword, key);
         Console.WriteLine("Your string decodes to: {0}", decoded);
     }
 }
Beispiel #2
0
        static void getExercise(string userChoice)
        {
            switch (userChoice)
            {
            case "1":
                int userNumber = Exercise1.chooseNumber();
                Exercise1.homeworkEx1(userNumber);
                Exercise1.printEx1();
                break;

            case "2":
                Exercise2.addElement();
                Exercise2.wordLength(Exercise2.sArray);
                break;

            case "3":
                Exercise3.addElement();
                int wordLength = Exercise3.longestWord(Exercise3.sArray);
                Console.WriteLine("The longest work is {0} letters.", wordLength);
                break;

            case "4":
                string pickedWord   = Exercise4.userWord();
                int    pickedLength = Exercise4.wordLength(pickedWord);
                // Console.WriteLine("Your word {0} is {1} letters long.", pickedWord, pickedLength); // This is print Debugging
                Exercise4.wordReversed(pickedWord, pickedLength);
                break;

            case "5":
                int rows    = Exercise5.rows();
                int columns = Exercise5.columns();
                int[,] map = new int[rows, columns];
                Exercise5.testArray(map);
                Exercise5.addArray(map);
                break;

            case "6":
                // Class for Exercise 6 instanced at top
                studentChi.addGradesManaul();
                float averageChi = studentChi.gradeAverage(studentChi.Grades);
                studentChi.gradeDebug();
                Console.WriteLine(" Student Name: {0} {1} \n Current Average {2}", studentChi.FirstName, studentChi.LastName, averageChi);
                break;

            case "7":
                // This is an extension of Ex 6 and will use the same class/instance.
                studentChi.addGradesManaul();
                float chiGPA = studentChi.studentGPA(studentChi.Grades);
                Console.WriteLine(" Student Name: {0} {1} \n Current GPA {2}", studentChi.FirstName, studentChi.LastName, chiGPA);
                break;

            case "8":
                int first  = Exercise8.firstNumber();
                int second = Exercise8.secondNumber();
                Exercise8.addNumbers(first, second);
                List <int> evens = Exercise8.evensOnly(Exercise8.numbers);
                Exercise8.printList(evens);
                break;

            case "9":
                // This exercise is an extension of Ex 8 and will use the same class.
                int firstOdd  = Exercise8.firstNumber();
                int secondOdd = Exercise8.secondNumber();
                Exercise8.addNumbers(firstOdd, secondOdd);
                List <int> odds = Exercise8.oddsOnly(Exercise8.numbers);
                Exercise8.printList(odds);
                break;

            case "10":
                //         Build testing / Error Checking.
                //Console.WriteLine("pvlrnpdwf with key dhy = monograph");
                //string encoded = Exercise10.encode(Exercise10.testString2, "dhy");
                //string decoded = Exercise10.decode(Exercise10.testString3, "dhy");
                //string decoded2 = Exercise10.decode(encoded, "dhy");
                //Console.WriteLine("Encode {0}", encoded);
                //Console.WriteLine("Decode {0}, {1}", decoded, decoded2);

                string choice   = Exercise10.operationChoice();
                string userword = Exercise10.userWord();
                string key      = Exercise10.keyWord();
                Exercise10.runChoice(choice, userword, key);
                break;

            case "11":
                Exercise11.pruneList(Exercise11.list1, Exercise11.list2);
                Exercise11.printList(Exercise11.list1);
                break;

            case "12":

                Console.WriteLine("Not yet implemented");
                break;
            }
        }