public string Get(LicensePlate licensePlate)
 {
     if (this.owners.ContainsKey(licensePlate))
     {
         return(this.owners[licensePlate]);
     }
     else
     {
         return("No such license");
     }
 }
 public bool Remove(LicensePlate licensePlate)
 {
     if (owners.ContainsKey(licensePlate))
     {
         return(owners.Remove(licensePlate));
     }
     else
     {
         return(false);
     }
 }
 public string Get(LicensePlate licensePlate)
 {
     if (this.owners.ContainsKey(licensePlate))
     {
         return(this.owners[licensePlate]);
     }
     else
     {
         return("License plate Not found in registry!");
     }
 }
Esempio n. 4
0
 public string Get(LicensePlate licensePlate)
 {
     if (owners.ContainsKey(licensePlate))
     {
         return(owners[licensePlate]);
     }
     else
     {
         return("No such license found in registry!");
     }
 }
 public bool Add(LicensePlate licensePlate, string owner)
 {
     if (owners.ContainsKey(licensePlate))
     {
         return(false);
     }
     else
     {
         this.owners.Add(licensePlate, owner);
         return(true);
     }
 }
 public bool Remove(LicensePlate licensePlate)
 {
     if (this.owners.ContainsKey(licensePlate))
     {
         this.owners.Remove(licensePlate);
         return(true);
     }
     else
     {
         return(false);
     }
 }
 public bool Add(LicensePlate licensePlate, string owner)
 {
     if (owners.ContainsKey(licensePlate))
     {
         System.Console.WriteLine("License plate already exists!");
         return(false);
     }
     else
     {
         this.owners.Add(licensePlate, owner);
         // System.Console.WriteLine("License plate added!");
         return(true);
     }
 }
Esempio n. 8
0
        public bool Remove(LicensePlate licensePlate)
        {
            if (this.owners.ContainsKey(licensePlate))
            {
                this.owners.Remove(licensePlate);
                return(true);
            }

            else
            {
                Console.WriteLine("ei voitu poistaa");
                return(false);
            }
        }
        public override bool Equals(object compared)
        {
            if (this == compared)
            {
                return(true);
            }
            if ((compared == null) || !this.GetType().Equals(compared.GetType()))
            {
                return(false);
            }
            LicensePlate comparedPlate = (LicensePlate)compared;

            return(this.liNumber == comparedPlate.liNumber && this.country == comparedPlate.country);
        }
Esempio n. 10
0
        public override bool Equals(object compared)
        {
            if (this == compared)
            {
                return(true);
            }
            if ((compared == null) || !this.GetType().Equals(compared.GetType()))
            {
                return(false);
            }
            LicensePlate comparedPlate = (LicensePlate)compared;

            // If the values of the object variables are the same,
            //the objects are equal.
            return(this.liNumber == comparedPlate.liNumber &&
                   this.country == comparedPlate.country);
        }
Esempio n. 11
0
        public override bool Equals(object compared)
        {
            if (this == compared) //Compares the locations of the objects. If they are the same, they are equal.
            {
                return(true);
            }

            // If the compared object is null, or not of the correct type, then they are not equal.
            if ((compared == null) || !this.GetType().Equals(compared.GetType()))
            {
                return(false);
            }

            // Converts the object to an object specific to this class.
            LicensePlate comparedPlate = (LicensePlate)compared;

            // If the values of the object variables are the same, the objects are equal.
            return(this.liNumber == comparedPlate.liNumber && this.country == comparedPlate.country);
        }
Esempio n. 12
0
        public static void Main(string[] args)
        {
            LicensePlate li1 = new LicensePlate("FI", "ABC-123");
            LicensePlate li2 = new LicensePlate("FI", "UXE-465");
            LicensePlate li3 = new LicensePlate("D", "B WQ-431");
            LicensePlate li4 = new LicensePlate("D", "B WQ-432");
            LicensePlate li5 = new LicensePlate("D", "B WQ-433");

            VehicleRegistry register = new VehicleRegistry();

            register.Add(li1, "Arto");
            register.Add(li2, "Arto");
            register.Add(li3, "Jürgen");
            register.Add(li4, "Jürgen");
            register.Add(li5, "Jürgen");

            Console.WriteLine("Plates:");
            register.PrintLicensePlates();

            Console.WriteLine("Owners:");
            register.PrintOwners();
        }
Esempio n. 13
0
        public override bool Equals(object compared)
        {
            // if the variables are located in the same position, they are equal
            if (this == compared)
            {
                return(true);
            }

            // if the compared object is null or not of type LicencePlate, the objects are not equal
            if ((compared == null) || !this.GetType().Equals(compared.GetType()))
            {
                return(false);
            }
            else
            {
                // convert the object to a LicencePlate object
                LicensePlate comparedPlate = (LicensePlate)compared;

                // if the values of the object variables are equal, the objects are, too
                return(this.liNumber == comparedPlate.liNumber && this.country == comparedPlate.country);
            }
        }
Esempio n. 14
0
 public bool Add(LicensePlate licensePlate, string owner)
 {
     return(false);
 }
Esempio n. 15
0
 public bool Remove(LicensePlate licensePlate)
 {
     return(false);
 }
Esempio n. 16
0
 public string Get(LicensePlate licensePlate)
 {
     return("No such license");
 }