Exemplo n.º 1
0
        public static void teacherMenu()
        {
            bool loopBreak = false;

            do
            {
                Console.WriteLine(""); //Lists out all options for the teacher Menu
                Console.WriteLine("What would you like to do?" + Environment.NewLine);
                Console.WriteLine("Press V to: view all of the students currently enrolled");
                Console.WriteLine("Press S to: enroll an additional student");
                Console.WriteLine("Press R to: remove a student from the class");
                Console.WriteLine("Press A to: view all questions & answers");
                Console.WriteLine("Press Q to: add another question to the quiz");
                Console.WriteLine("Press D to: remove a question from the quiz");
                Console.WriteLine("Press X to: exit the software" + Environment.NewLine);
                string choice = Console.ReadLine().ToUpper(); //Stores the user's choice

                choice = teacherChoice(choice);

                if (choice == "V")
                {
                    SchoolLogins.studentList(); //Call the method to view all users
                }
                else if (choice == "S")
                {
                    SchoolLogins.addStudent(); //Call the methods to add a user
                }
                else if (choice == "R")
                {
                    SchoolLogins.removeStudent(); //Calls the methods to remove a student
                }
                else if (choice == "A")
                {
                    SpellingList.quizOutput(); //Calls the method to view all questions and correct answers
                }
                else if (choice == "Q")
                {
                    SpellingList.addWord(); //Calls the method to a question & answer
                }
                else if (choice == "D")
                {
                    SpellingList.removeWord(); //Calls the method to remove a question & answer
                }
                else if (choice == "X")
                {
                    System.Environment.Exit(1); //Closes the software
                }
                else
                {
                    Console.WriteLine("Unknown Input Detected | Try again" + Environment.NewLine); //If the user's choice doesn't match, return an error
                }
            } while (loopBreak == false);
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            bool loopBreak = false;

            Console.WriteLine("Welcome to the Spelling Quiz"); //Welcomes the user to the system
            Console.WriteLine("Please Log in to use the system");

            do
            {
                Console.WriteLine("Please enter your Username");
                string usernameInput = Console.ReadLine().ToUpper(); //Saves the user's entered Username

                Console.WriteLine("Please enter your Password");
                string passwordInput = Console.ReadLine(); //Saves the user's entered Password

                List <string> loginInput = new List <string>(2)
                {
                    usernameInput, passwordInput                         //Saves both of the user inputs as a List
                };
                string userRole = SchoolLogins.detailsCheck(loginInput); //Passes the inputs to a method to check if they are recognised

                if (userRole == "Teacher")                               //If the user is recognised and is a teacher
                {
                    List <string> teacherName = new List <string>();
                    teacherName = SchoolLogins.userName();
                    Console.WriteLine("Welcome: {0} {1}", teacherName.ElementAt(0), teacherName.ElementAt(1) + Environment.NewLine); //Personalised Welcome Message
                    TeacherMenu.teacherMenu();                                                                                       //Loads the Teacher Menu for the Software
                }
                else if (userRole == "Student")                                                                                      //If the user is recognised and is a student
                {
                    List <string> studentName = new List <string>();
                    studentName = SchoolLogins.userName();
                    Console.WriteLine("Welcome: {0} {1}", studentName.ElementAt(0), studentName.ElementAt(1)); //Personalised Weclome Message
                    StudentMenu.startQuiz();                                                                   //Loads the Quiz
                }
                else //If the user is unrecognised
                {
                    loopBreak = false; //Resets the Loop
                    Console.WriteLine("Error | User not found | Please try Again" + Environment.NewLine);
                }
            } while (loopBreak == false);
        }