示例#1
0
 public MyPassport(string n, MyDate ed)
 {
     this.Name = n;
     MyPassport.NumberOfPassport += 1;
     this.PasportNumber           = MyPassport.NumberOfPassport;
     this.ExpiryDate              = ed;
 }
示例#2
0
 public MyPassport()
 {
     this.Name = null;
     MyPassport.NumberOfPassport += 1;
     this.PasportNumber           = MyPassport.NumberOfPassport;
     this.ExpiryDate              = new MyDate();
 }
示例#3
0
 public bool CheckTravel(MyDate TravelDate)
 {
     if (getIsPayed() == true && this.passPassanger.isValid(TravelDate) == false)
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
示例#4
0
文件: Program.cs 项目: webarak/OOP
        static void Main(string[] args)
        {
            MyTraveler T1 = new MyTraveler(new MyPassport("shahaf", new MyDate(1, 12, 2007)), true);
            MyTraveler T2 = new MyTraveler(new MyPassport("barak", new MyDate(1, 7, 2019)), false);
            MyTraveler T3 = new MyTraveler(new MyPassport("segev", new MyDate(11, 8, 2009)), true);

            MyDate d1 = new MyDate(1, 1, 2007);

            if (T1.CheckTravel(d1) == true)
            {
                Console.WriteLine(T1.ToString());
            }

            if (T2.CheckTravel(d1) == true)
            {
                Console.WriteLine(T2.ToString());
            }

            if (T3.CheckTravel(d1) == true)
            {
                Console.WriteLine(T3.ToString());
            }
        }
示例#5
0
文件: MyDate.cs 项目: webarak/OOP
        public bool before(MyDate d)
        {
            bool before = false;

            if (d.get_day() > 1)
            {
                if ((d.get_day() == this.day + 1) && (d.get_month() == this.month) && (d.get_year() == this.year))
                {
                    before = true;
                }
            }
            else if (d.get_day() == 1)
            {
                if ((this.day == 31) && (d.get_month() - 1 == this.month) && (d.get_year() == this.year))
                {
                    before = true;
                }
                else if ((this.day == 31) && (this.month == 12) && (this.year + 1 == d.get_year()))
                {
                    before = true;
                }
            }
            return(before);
        }
示例#6
0
 public bool isValid(MyDate dateChecked)
 {
     return(this.ExpiryDate.before(dateChecked));
 }
示例#7
0
 public void seteExpiryDate(MyDate newExpiryDate)
 {
     this.ExpiryDate = newExpiryDate;
 }
示例#8
0
 public MyPassport(MyPassport pass)
 {
     this.Name          = pass.getn();
     this.PasportNumber = pass.getpn();
     this.ExpiryDate    = pass.geted();
 }