static void Main()
        {
            var studentMaria = new Student("Maria", "Petrova","985112", 3, Specialty.BiologyTeacher, University.SofiaUneversity, Faculty.Biology);
            var studentPesho = new Student("Pesho", "Peshev", "159876", 4, Specialty.SoftwareEngineer, University.Technical, Faculty.Electronics);
            var otherPesho = studentPesho.Clone() as Student;

            Console.WriteLine("Compare Pesho and otherPesho:");
            Console.WriteLine("Equal: "+ studentPesho.Equals(otherPesho));
            Console.Write("==: ");
            Console.WriteLine( studentPesho == otherPesho);
            Console.Write("!=: ");
            Console.WriteLine(studentPesho != otherPesho);
            Console.WriteLine();
            Console.WriteLine("Compare Pesho and Maria:");
            Console.WriteLine("Equal: " + studentPesho.Equals(studentMaria));
            Console.Write("==: ");
            Console.WriteLine(studentPesho == studentMaria);
            Console.Write("!=: ");
            Console.WriteLine(studentPesho != studentMaria);
            Console.WriteLine();

            otherPesho.SSN = "546549";

            Console.WriteLine("Original Pesho:\n" +studentPesho.ToString());
            Console.WriteLine("Cloned Pesho:\n"+otherPesho.ToString());
            Console.WriteLine("Compairing Pesho and otherPesho " +studentPesho.CompareTo(otherPesho));
            Console.WriteLine("Compare Pesho and otherPesho:");
            //Console.WriteLine("Equal: " + studentPesho.Equals(otherPesho));
            Console.Write("==: ");
            //Console.WriteLine(studentPesho == otherPesho);
            Console.Write("!=: ");
            //Console.WriteLine(studentPesho != otherPesho);
            Console.WriteLine();
        }
Exemple #2
0
        static void Main()
        {
            var student1 = new Student("Slim", "Marshal", "Shady", 666666666, "Detroit", "+35988888888", "*****@*****.**",
                3, Specialties.Psychology, Universities.SofiaUniversity, Faculties.Europeistics);
            Console.WriteLine(student1.GetHashCode());

            var student2 = new Student("Doctor", "Young", "Dre", 666222666, "Detroit", "+35988888888", "*****@*****.**",
                4, Specialties.Phylosophy, Universities.TechnicalUniversity, Faculties.Languages);
            Console.WriteLine(student2.GetHashCode());

            Console.WriteLine();

            Console.WriteLine(student1);
            Console.WriteLine();

            Console.WriteLine(student2);
            Console.WriteLine();

            Console.WriteLine("student1 == student2 : {0}", student1 == student2);
            Console.WriteLine("student1 != student2 : {0}", student1 != student2);
            Console.WriteLine("student1.Equals(student1) : {0}", student1.Equals(student1));
            Console.WriteLine("student1.Equals(student2) : {0}", student1.Equals(student2));
            Console.WriteLine();

            var person1 = new Person("Slim Shady", 42);
            var person2 = new Person("Doctor Dre");

            Console.WriteLine(person1);
            Console.WriteLine(person2);
        }
Exemple #3
0
        static void Main()
        {
            var student1 = new Student("Slim", "Marshal", "Shady", 666666666, "Detroit", "+35988888888", "*****@*****.**",
                                       3, Specialties.Psychology, Universities.SofiaUniversity, Faculties.Europeistics);

            Console.WriteLine(student1.GetHashCode());

            var student2 = new Student("Doctor", "Young", "Dre", 666222666, "Detroit", "+35988888888", "*****@*****.**",
                                       4, Specialties.Phylosophy, Universities.TechnicalUniversity, Faculties.Languages);

            Console.WriteLine(student2.GetHashCode());

            Console.WriteLine();

            Console.WriteLine(student1);
            Console.WriteLine();

            Console.WriteLine(student2);
            Console.WriteLine();

            Console.WriteLine("student1 == student2 : {0}", student1 == student2);
            Console.WriteLine("student1 != student2 : {0}", student1 != student2);
            Console.WriteLine("student1.Equals(student1) : {0}", student1.Equals(student1));
            Console.WriteLine("student1.Equals(student2) : {0}", student1.Equals(student2));
            Console.WriteLine();

            var person1 = new Person("Slim Shady", 42);
            var person2 = new Person("Doctor Dre");

            Console.WriteLine(person1);
            Console.WriteLine(person2);
        }
Exemple #4
0
        static void Main(string[] args)
        {
            Person person  = new Person("Viorela", null);
            Person person1 = new Person("Alex", 26);

            Console.WriteLine(person);
            Console.WriteLine(person1);

            //public Student(string FirstName, string MiddleName, string Lastname, ulong SSN, ulong Mobile, string Adress, string email, string course, University university, Faculty faculty, Specialty specialty)
            Student student1 = new Student("Hariga", "Elena", "Viorela", 213223123, 741669147, "Nicolae Iorga", "*****@*****.**", "Math", University.AlexandruIoanCuza, Faculty.BusinessAdministration, Specialty.BusinessAdministrationSystem);
            Student student2 = new Student("Budianu", "Viorela", "Elena", 213223123, 741669147, "Nicolae Iorga", "*****@*****.**", "Math", University.AlexandruIoanCuza, Faculty.BusinessAdministration, Specialty.BusinessAdministrationSystem);

            Console.WriteLine("First student equal to second student? {0}", Student.Equals(student1, student2));
            Console.WriteLine("First student == second student? {0}", student1 == student2);
            Console.WriteLine("Firs student != second student? {0}", student1 != student2);
            Console.WriteLine();

            Student student = new Student("Budianu", "Viorela", "Elena", 213223123, 741669147, "Nicolae Iorga", "*****@*****.**", "Math", University.AlexandruIoanCuza, Faculty.BusinessAdministration, Specialty.BusinessAdministrationSystem);

            Console.WriteLine("First student equal to third student? {0}", Student.Equals(student1, student));
            Console.WriteLine("First student == third student? {0}", student1 == student);
            Console.WriteLine("First student != third student? {0}", student1 != student);
            Console.WriteLine();

            Student s = student.Clone();

            Console.WriteLine(student + "++++++++++\n" + s);

            Console.WriteLine(student.CompareTo(s));
            Console.WriteLine(student.CompareTo(student1));

            Console.WriteLine($"HasCode for s (cloned) - {s.GetHashCode()}\nHasCode for student - {student.GetHashCode()}");
        }
        public static void Main(string[] args)
        {
            Student firstStudent = new Student(
                "Pesho",
                "Peshov",
                "Peshov",
                12134314,
                "some address",
                "+359888 888 888",
                "*****@*****.**",
                UniversityEnum.TechnicalUniversity,
                FacultyEnum.FTK,
                SpecialtyEnum.TK,
                CourseEnum.First);

            Student testEqualStudent = new Student(
                "Pesho",
                "Peshov",
                "Peshov",
                12134314,
                "some address",
                "+359888 888 888",
                "*****@*****.**",
                UniversityEnum.TechnicalUniversity,
                FacultyEnum.FTK,
                SpecialtyEnum.TK,
                CourseEnum.First);

            Student secondStudent = new Student(
                "Gosho",
                "Goshov",
                "Goshov",
                12134315,
                "another address",
                "+359888 999 999",
                "*****@*****.**",
                UniversityEnum.TelericAcademy,
                FacultyEnum.Ninja,
                SpecialtyEnum.TelericAcademyNinja,
                CourseEnum.Second);

            Console.WriteLine("First student equals second student: {0}", firstStudent.Equals(secondStudent));

            Console.WriteLine("First student == test equal student student: {0}", firstStudent == testEqualStudent);

            Console.WriteLine("\nStudent.ToString():\n{0}", firstStudent.ToString());

            Student clonedStudent = (Student)secondStudent.Clone();

            Console.WriteLine("Deep cloned student:\n{0}", clonedStudent.ToString());

            Console.WriteLine("First student compared to second student: {0}", firstStudent.CompareTo(secondStudent));

            Console.WriteLine("Second student compared to cloned student: {0}", secondStudent.CompareTo(clonedStudent));

            Console.WriteLine("Second student compared to first student: {0}", secondStudent.CompareTo(firstStudent));
        }
        private static void MakeStudent()
        {
            var subjects = new string[] { "Maths", "PE", "Physics", "History" };


            var st1_1 = new Student("Kirill Kononov", "*****@*****.**");
            var st1_2 = new Student("Ivan Ivanov", "*****@*****.**");
            var st1_3 = new Student("Petr Petrov", "*****@*****.**");


            var st2_1 = new Student("*****@*****.**");
            var st2_2 = new Student("*****@*****.**");
            var st2_3 = new Student("*****@*****.**");


            var studentSubjectDict = new Dictionary <Student, HashSet <string> > {
            };
            var rnd = new Random();

            studentSubjectDict[st1_1] = new HashSet <string> {
                subjects[rnd.Next(subjects.Length)],
                subjects[rnd.Next(subjects.Length)],
                subjects[rnd.Next(subjects.Length)]
            };
            studentSubjectDict[st1_2] = new HashSet <string> {
                subjects[rnd.Next(subjects.Length)],
                subjects[rnd.Next(subjects.Length)],
                subjects[rnd.Next(subjects.Length)]
            };
            studentSubjectDict[st1_3] = new HashSet <string> {
                subjects[rnd.Next(subjects.Length)],
                subjects[rnd.Next(subjects.Length)],
                subjects[rnd.Next(subjects.Length)]
            };
            studentSubjectDict[st2_1] = new HashSet <string> {
                subjects[rnd.Next(subjects.Length)],
                subjects[rnd.Next(subjects.Length)],
                subjects[rnd.Next(subjects.Length)]
            };
            studentSubjectDict[st2_2] = new HashSet <string> {
                subjects[rnd.Next(subjects.Length)],
                subjects[rnd.Next(subjects.Length)],
                subjects[rnd.Next(subjects.Length)]
            };
            studentSubjectDict[st2_3] = new HashSet <string> {
                subjects[rnd.Next(subjects.Length)],
                subjects[rnd.Next(subjects.Length)],
                subjects[rnd.Next(subjects.Length)]
            };

            Console.WriteLine(studentSubjectDict.Count());
            Console.WriteLine(st1_1.Equals(st2_1));


            foreach (var student in studentSubjectDict)
            {
                Console.WriteLine(student.Key.Name + " " + student.Key.Email);
            }

            Console.ReadLine();
        }