Esempio n. 1
0
            static string CreateAspirant()
            {
                String     surname = null;
                int        year    = 0;
                int        number  = 0;
                String     thesis  = null;
                AsDatabase astbase = new AsDatabase();
                int        n       = 0;//counter aspirant
                string     choice  = "2";

                while (choice == "2")
                {
                    Console.WriteLine("type surname");
                    surname = Console.ReadLine();
                    Console.WriteLine("type study year");
                    year = Convert.ToInt32(Console.ReadLine());
                    if (year > 2)
                    {
                        Console.WriteLine("Study year for Aspirants cant be more than 2"); year = 2;
                    }
                    Console.WriteLine("type student number");
                    number = Convert.ToInt32(Console.ReadLine());
                    Console.WriteLine("type Thesis theme");
                    thesis     = Console.ReadLine();
                    astbase[n] = new AspirantPerson(surname, year, number, thesis);
                    n          = n + 1;
                    Console.WriteLine("For new student type - 1 \t  For new aspirant- 2 \t For Student information -3 \t For Aspirant information -4 \t For compare Students-5 \t For compare Aspirants-6 \t Type -end- to exit ");
                    choice = Console.ReadLine();
                }
                while (choice == "4")
                {
                    Console.WriteLine("Enter index");
                    int m = Convert.ToInt32(Console.ReadLine());
                    astbase[m].Display();
                    Console.WriteLine("Object to string " + astbase[m].ToString());
                    Console.WriteLine("Get hash code " + astbase[m].GetHashCode());
                    Console.WriteLine("Gettype " + astbase[m].GetType());
                    Console.WriteLine("For new student type - 1 \t Type - end - to exit \t For new aspirant- 2 \t For information -3 \t For Students information -4 \t For compare Students-5 \t For compare Aspirants-6 \t Type -end- to exit ");
                    choice = Console.ReadLine();
                }
                while (choice == "6")
                {
                    int a; int b; bool result;
                    Console.WriteLine("Type the 1st student index");
                    a = Convert.ToInt32(Console.ReadLine());
                    Console.WriteLine("Type the 2nd student index");
                    b = Convert.ToInt32(Console.ReadLine());
                    bool asequal = astbase[a].Equals(astbase[b]);
                    Console.WriteLine("object equal" + asequal);
                    Console.WriteLine("For new student type - 1 \t Type - end - to exit \t For new aspirant- 2 \t For information -3 \t For Students information -4 \t For compare Students-5 \t For compare Aspirants-6 \t Type -end- to exit ");
                    choice = Console.ReadLine();
                }

                return(choice);
            }
Esempio n. 2
0
        static void Main(string[] args)
        {
            SDatabase  stbase  = new SDatabase();
            AsDatabase astbase = new AsDatabase();

            string choice; link1:

            Console.WriteLine("For new student type - 1");
            Console.WriteLine("For new aspirant- 2 ");
            Console.WriteLine("For information about Students-3");
            Console.WriteLine("For information about Aspirants-4");
            Console.WriteLine("For compare Students-5");
            Console.WriteLine("For compare Aspirants-6");
            Console.WriteLine("Type -end- to exit");
            choice = Console.ReadLine();

            switch (choice)
            {
            case "1":
                CreateStudent(); goto link1;
                break;

            case "2":
                CreateAspirant(); goto link1;
                break;

            case "3":
                CreateStudent(); goto link1;
                break;

            case "4":
                CreateAspirant(); goto link1;
                break;

            case "5":
                CreateStudent(); goto link1;
                break;

            case "6":
                CreateAspirant(); goto link1;
                break;

            case "end":

                break;

            default:
                Console.WriteLine("Choose from menu"); goto link1;
                break;
            }


            Console.ReadKey();