Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Text;
- public enum University
- {
- SU, TU, NBU, UNSS
- }
- public enum Faculty
- {
- Philosophy, Law, Mathematics, Phisics, Business, Management, Telecommunications
- }
- public enum Specialty
- {
- Telecommunications, Marketing, Business, Entrepreneurship, Phisics, Mathematics, Informatics, Law, Philosophy
- }
- public class Student : ICloneable, IComparable<Student>
- {
- private string firstName;
- private string middleName;
- private string lastName;
- private string address;
- private int phone;
- private int course;
- private int ssn;
- private Specialty specialty;
- private University university;
- private Faculty faculty;
- public string FirstName
- {
- get { return this.firstName; }
- set { this.firstName = value; }
- }
- public string MiddleName
- {
- get { return this.middleName; }
- set { this.middleName = value; }
- }
- public string LastName
- {
- get { return this.lastName; }
- set { this.lastName = value; }
- }
- public string Address
- {
- get { return this.address; }
- set { this.address = value; }
- }
- public int Phone
- {
- get { return this.phone; }
- set { this.phone = value; }
- }
- public int Course
- {
- get { return this.course; }
- set { this.course = value; }
- }
- public Specialty Specialty
- {
- get { return this.specialty; }
- set { this.specialty = value; }
- }
- public University University
- {
- get { return this.university; }
- set { this.university = value; }
- }
- public Faculty Faculty
- {
- get { return this.faculty; }
- set { this.faculty = value; }
- }
- public int SSN
- {
- get { return this.ssn; }
- set { this.ssn = value; }
- }
- public Student()
- {
- }
- public Student(string firstName, string middleName, string lastName, string address, int phone, int course, int ssn, Specialty specialty, University university, Faculty faculty)
- {
- this.FirstName = firstName;
- this.MiddleName = middleName;
- this.LastName = lastName;
- this.Address = address;
- this.Phone = phone;
- this.Course = course;
- this.SSN = ssn;
- this.Specialty = specialty;
- this.University = university;
- this.Faculty = faculty;
- }
- public override string ToString()
- {
- StringBuilder build = new StringBuilder();
- build.AppendLine(this.FirstName);
- build.AppendLine(this.MiddleName);
- build.AppendLine(this.LastName);
- build.AppendLine(this.Address);
- build.AppendLine(this.Phone.ToString());
- build.AppendLine(this.Course.ToString());
- build.AppendLine(this.SSN.ToString());
- build.AppendLine(this.Specialty.ToString());
- build.AppendLine(this.University.ToString());
- build.AppendLine(this.Faculty.ToString());
- return build.ToString();
- }
- public override bool Equals(object param)
- {
- Student student = param as Student;
- if (student == null)
- {
- return false;
- }
- if (!Object.Equals(this.FirstName, student.FirstName))
- {
- return false;
- }
- if (!Object.Equals(this.LastName, student.LastName))
- {
- return false;
- }
- if (this.SSN != student.SSN)
- {
- return false;
- }
- return true;
- }
- public static bool operator ==(Student student1, Student student2)
- {
- return Student.Equals(student1, student2);
- }
- public static bool operator !=(Student student1, Student student2)
- {
- return !(Student.Equals(student1, student2));
- }
- public override int GetHashCode()
- {
- return LastName.GetHashCode() ^ SSN.GetHashCode();
- }
- public Student Clone()
- {
- Student clone = new Student
- (
- this.FirstName,
- this.MiddleName,
- this.LastName,
- this.Address,
- this.Phone,
- this.Course,
- this.SSN,
- this.Specialty,
- this.University,
- this.Faculty
- );
- return clone;
- }
- object ICloneable.Clone()
- {
- return this.Clone();
- }
- public int CompareTo(Student student)
- {
- if (this.LastName != student.LastName)
- {
- return (String.Compare(this.LastName, student.LastName));
- }
- if (this.FirstName != student.FirstName)
- {
- return (String.Compare(this.FirstName, student.FirstName));
- }
- if (this.SSN != student.SSN)
- {
- return ( this.SSN - student.SSN);
- }
- return 0;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement