示例#1
0
        static void Main(string[] args)
        {
            //Displays a hello message to the specific user.
            User alice = new User("Alice");

            alice.Hello();

            User bob = new User("Robert");

            bob.Hello();

            Console.WriteLine(alice.ToString());
            //Console.WriteLine(alice.UserName);

            Student bobStudent = new Student();

            bobStudent.Hello();
            //bobStudent.n

            //Displays message from hello 2 method that will print newuser because it wasn't assigned a username and they new student classes.
            User test1 = new Student();

            test1.Hello2();
            Student test2 = new Student();

            test2.Hello2();

            //Creates a list and adds random integers then calls the method to generate a random value.
            MagicList <int> myList = new MagicList <int>();

            myList.Add(10);
            myList.Add(20);
            myList.Add(30);
            myList.Add(40);
            Console.WriteLine(myList.ChooseRandom());


            //Creates 8 user names and them adds them to the magicListOfUsers and then we pull a random number.
            User             st1 = new User(); st1.UserName = "******";
            User             st2 = new User(); st2.UserName = "******";
            User             st3 = new User(); st3.UserName = "******";
            User             st4 = new User(); st4.UserName = "******";
            User             st5 = new User(); st5.UserName = "******";
            User             st6 = new User(); st6.UserName = "******";
            User             st7 = new User(); st7.UserName = "******";
            User             st8 = new User(); st8.UserName = "******";
            MagicList <User> magicListOfUsers = new MagicList <User>();

            magicListOfUsers.Add(st1);
            magicListOfUsers.Add(st2);
            magicListOfUsers.Add(st3);
            magicListOfUsers.Add(st4);
            magicListOfUsers.Add(st5);
            magicListOfUsers.Add(st6);
            magicListOfUsers.Add(st7);
            magicListOfUsers.Add(st8);
            Console.WriteLine(magicListOfUsers.ChooseRandom());
            Console.WriteLine(magicListOfUsers[3]); //pulls the third index
        }
示例#2
0
        static void Main(string[] args)
        {
            User alice = new User("Alice");

            alice.Hello();

            User bob = new User("Robert");

            bob.Hello();

            Console.WriteLine(alice.ToString());
            //Console.WriteLine(alice.UserName);

            Student bobStudent = new Student();

            bobStudent.Hello();
            //bobStudent.n

            User test1 = new Student();

            test1.Hello2();
            Student test2 = new Student();

            test2.Hello2();

            MagicList <int> myList = new MagicList <int>();

            myList.Add(10);
            myList.Add(20);
            myList.Add(30);
            myList.Add(40);
            Console.WriteLine(myList.ChooseRandom());


            User             st1 = new User(); st1.UserName = "******";
            User             st2 = new User(); st2.UserName = "******";
            User             st3 = new User(); st3.UserName = "******";
            User             st4 = new User(); st4.UserName = "******";
            User             st5 = new User(); st5.UserName = "******";
            User             st6 = new User(); st6.UserName = "******";
            User             st7 = new User(); st7.UserName = "******";
            User             st8 = new User(); st8.UserName = "******";
            MagicList <User> magicListOfUsers = new MagicList <User>();

            magicListOfUsers.Add(st1);
            magicListOfUsers.Add(st2);
            magicListOfUsers.Add(st3);
            magicListOfUsers.Add(st4);
            magicListOfUsers.Add(st5);
            magicListOfUsers.Add(st6);
            magicListOfUsers.Add(st7);
            magicListOfUsers.Add(st8);
            Console.WriteLine(magicListOfUsers.ChooseRandom());
            Console.WriteLine(magicListOfUsers[3]); //
        }