Exemplo n.º 1
0
        public void AddGuitar(SerialNumberEnum serialNumber, double price, Builder builder, Model model, Type_enum type,
                              Back_WoodEnum backWood, TopWoodEnum topWood)
        {
            Guitar guitar = new Guitar(serialNumber, price, builder, model, type, backWood, topWood);

            guitars.Add(guitar);
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            Inventory inventory = new Inventory();

            InitializeInventory(inventory);

            Guitar whatErinLikes = new Guitar(SerialNumberEnum.NUMBER1, 1499.95, Builder.ANY, Model.JUSTIN,
                                              Type_enum.ACOUSTIC, Back_WoodEnum.CHINESE, TopWoodEnum.WOOD1);

            Guitar guitar = inventory.Search(whatErinLikes);

            if (guitar != null)
            {
                Console.WriteLine("Erin, you might like this" +
                                  guitar.Builder + " " + guitar.Model + " " +
                                  guitar.Type + "guitar:\n  " +
                                  guitar.BackWood + " back and sides,\n  " +
                                  guitar.TopWood + " top.\nYou can have it for you $" +
                                  guitar.Price + "!");
            }
            else
            {
                Console.WriteLine("Sorry, Erin, we have nothing for you.");
            }
            Console.ReadKey();
        }
Exemplo n.º 3
0
 public Guitar GetGuitar(string serialNumber)
 {
     for (int i = 0; i < guitars.Count; i++)
     {
         Guitar guitar = guitars[i];
         if (guitar.SerialNumber.Equals(serialNumber))
         {
             return(guitar);
         }
     }
     return(null);
 }
Exemplo n.º 4
0
        public Guitar Search(Guitar searchGuitar)
        {
            for (int i = 0; i < guitars.Count; i++)
            {
                Guitar guitar  = guitars[i];
                string builder = searchGuitar.Builder.ToString();
                if ((builder != null) && (!builder.Equals("")) &&
                    (!builder.Equals(guitar.Builder)))
                {
                    continue;
                }
                string model = searchGuitar.Model.ToString();
                if ((model != null) && (!model.Equals("")) &&
                    (!model.Equals(guitar.Model)))
                {
                    continue;
                }
                string type = searchGuitar.Type.ToString();
                if ((type != null) && (!type.Equals("")) &&
                    (!type.Equals(guitar.Type)))
                {
                    continue;
                }
                string backWood = searchGuitar.BackWood.ToString();
                if ((backWood != null) && (!backWood.Equals("")) &&
                    (!backWood.Equals(guitar.BackWood)))
                {
                    continue;
                }
                string topWood = searchGuitar.TopWood.ToString();
                if ((topWood != null) && (!topWood.Equals("")) &&
                    (!topWood.Equals(guitar.TopWood)))
                {
                    continue;
                }

                return(guitar);
            }
            return(null);
        }