Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- public class Person{
- private string name1;
- private string name2;
- private System.DateTime birth;
- public Person()
- {
- name1="polya";
- name2="ivanova";
- birth=new DateTime(1999,11,22);
- }
- public Person(string n1,string n2,DateTime b)
- {
- this.name1=n1;
- this.name2=n2;
- this.birth=b;
- }
- /////////////////
- public string Name
- {
- get
- {
- return name1;
- }
- set {
- name1=value;
- }
- }
- public string SecondName
- {
- get
- {
- return name2;
- }
- set {
- name2=value;
- }
- }
- ////////////
- public DateTime Birth
- {
- get
- {
- return birth;
- }
- set {
- birth=value;
- }
- }
- public int Year
- {
- get
- {
- return birth.Year;
- }
- set {
- birth=new DateTime(value,birth.Month,birth.Day);
- }
- }
- /////////////
- public override string ToString()
- {
- return Name+SecondName+Birth.ToString();
- }
- public virtual string ToShortString()
- {
- return Name+SecondName;
- }
- }
- ////////////////////////////
- enum Education {Specialist, Вachelor, SecondEducation}
- class Exam
- {
- string subject;
- int rate;
- DateTime examday;
- ///////////////
- public string Subject
- {
- get
- {
- return subject;
- }
- set {
- subject=value;
- }
- }
- public int Rate
- {
- get
- {
- return rate;
- }
- set {
- rate=value;
- }
- }
- ////////////
- public DateTime Examday
- {
- get
- {
- return examday;
- }
- set {
- examday=value;
- }
- }
- public Exam()
- {
- subject="pract";
- rate=5;
- examday=new DateTime(2017,05,30);
- }
- public Exam(string sub,int r,DateTime ed)
- {
- this.subject=sub;
- this.rate=r;
- this.examday=ed;
- }
- public override string ToString()
- {
- return Subject+Rate.ToString()+Examday.ToString();
- }
- }
- ///////////////
- //////////////
- public class Student
- {
- private Person pers;
- private Education fo;
- private int gruppa;
- private Exam[] exams;
- /////
- public Student()
- {
- pers.Birth=new DateTime(1999,11,22);
- fo=Education.Вachelor;
- gruppa=862;
- }
- public Student(Person per,Education edu,int g)
- {
- this.pers=per;
- this.fo=edu;
- this.gruppa=g;
- }
- }
- public class Program
- {
- public static void Main()
- {
- DateTime d=new DateTime(1999,11,22);
- Person f= new Person("polya","ivanova",d);
- f.Year=2000;
- Console.WriteLine(f.Year);
- Console.WriteLine(f.ToString());
- Console.WriteLine(f.ToShortString());
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement