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