Example #1
0
 public MyPassport(string n, MyDate ed)
 {
     this.Name = n;
     MyPassport.NumberOfPassport += 1;
     this.PasportNumber           = MyPassport.NumberOfPassport;
     this.ExpiryDate              = ed;
 }
Example #2
0
 public MyPassport()
 {
     this.Name = null;
     MyPassport.NumberOfPassport += 1;
     this.PasportNumber           = MyPassport.NumberOfPassport;
     this.ExpiryDate              = new MyDate();
 }
Example #3
0
 public bool CheckTravel(MyDate TravelDate)
 {
     if (getIsPayed() == true && this.passPassanger.isValid(TravelDate) == false)
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
Example #4
0
        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());
            }
        }
Example #5
0
        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);
        }
Example #6
0
 public bool isValid(MyDate dateChecked)
 {
     return(this.ExpiryDate.before(dateChecked));
 }
Example #7
0
 public void seteExpiryDate(MyDate newExpiryDate)
 {
     this.ExpiryDate = newExpiryDate;
 }
Example #8
0
 public MyPassport(MyPassport pass)
 {
     this.Name          = pass.getn();
     this.PasportNumber = pass.getpn();
     this.ExpiryDate    = pass.geted();
 }