public region(string _name, string _prefet, Commune _cheflieu) { this.name = _name; this.prefet = _prefet; this.chefLieu = _cheflieu; this.myCommunes.Add(_cheflieu); }
public region(string _name, string _prefet, int nofcommune) { this.name = _name; this.prefet = _prefet; for (int _ = 0; _ <= nofcommune; _++) { myCommunes.Add(new Commune()); } this.chefLieu = myCommunes[0]; }
public region(string _name, string _prefet, Commune _cheflieu, List <Commune> liste) { this.name = _name; this.prefet = _prefet; this.chefLieu = _cheflieu; this.myCommunes = liste; if (!this.appartenance(this.chefLieu)) { this.myCommunes.Add(this.chefLieu); } }
public bool appartenance(Commune other) { bool res = false; for (int i = 0; i < this.myCommunes.Count; i++) { if (this.myCommunes[i].equals(other)) { res = true; break; } } return(res); }
static void Main(string[] args) { Commune paris = new Commune("Paris", 75, "FRance", 2200000, "Hidalgo"); Commune rouen = new Commune("rouen", 76, "FRance", 111000, "Robert"); paris.Nhabitant = 2220000; string s = paris.tostring(); bool b = paris.equals(rouen); Console.WriteLine(s); Console.ReadLine(); Console.Clear(); Commune marly = new Commune("Marly"); region IledeFrance = new region("Ile de FRance", "prefet", new Commune("Paris")); IledeFrance.Add(new Commune("VErsaille")); IledeFrance.Add(marly); Console.WriteLine(IledeFrance.appartenance(new Commune())); Console.WriteLine(IledeFrance.appartenance(marly)); Console.ReadLine(); IledeFrance.disp(); Console.ReadLine(); Console.Clear(); IledeFrance.alphasort(); IledeFrance.disp(); Console.ReadLine(); Console.Clear(); Console.WriteLine(IledeFrance.tostring()); Console.WriteLine(IledeFrance.popTotal()); Console.ReadLine(); Console.Clear(); region megapole = new region("big", "unprefet", 100); megapole.disp(); Console.ReadLine(); Console.Clear(); megapole.alphasort(); megapole.disp(); Console.ReadLine(); }
public void Add(Commune acomm) { this.myCommunes.Add(acomm); }
public static bool equalstatic(Commune A, Commune B) { return(A.equals(B)); }
public bool equals(Commune other) { return(this.nhabitant == other.nhabitant); }