Ejemplo n.º 1
0
        public override bool Equals(object obj)
        {
            GuitarSpec guitarSpec = (GuitarSpec)obj;

            return(
                this.Builder == guitarSpec.Builder &&
                this.Model.ToLower() == guitarSpec.Model.ToLower() &&
                this.Type == guitarSpec.Type &&
                this.BackWood == guitarSpec.BackWood &&
                this.TopWood == guitarSpec.TopWood &&
                this.NumStrings == guitarSpec.NumStrings
                );
        }
Ejemplo n.º 2
0
        public LinkedList <Guitar> Search(GuitarSpec searchSpec)
        {
            LinkedList <Guitar> matchingGuitars = new LinkedList <Guitar>();

            foreach (Guitar guitar in this.guitars)
            {
                GuitarSpec guitarSpec = guitar.Spec;
                if (searchSpec.Equals(guitarSpec))
                {
                    matchingGuitars.AddLast(guitar);
                }
            }
            return(matchingGuitars);
        }
Ejemplo n.º 3
0
        static void Main(string[] args)
        {
            //Configura estoque de guitarras
            Inventory inventory = new Inventory();

            InitializeInventory(inventory);

            GuitarSpec          whatErinLikes   = new GuitarSpec(Builder.FENDER, "Stratocaster", Type.ACOUSTIC, Wood.ADIRONDACK, Wood.BRAZILIAN_ROSEWOOD, 12);
            LinkedList <Guitar> matchingGuitars = inventory.Search(whatErinLikes);

            if (matchingGuitars.Count != 0)
            {
                Console.WriteLine("Erin, talvez você goste destas guitarras:");
                foreach (Guitar guitar in matchingGuitars)
                {
                    Console.WriteLine(guitar.ToString());
                }
            }
            else
            {
                Console.WriteLine("Desculpe Erin, não temos nada pra você");
            }
        }
Ejemplo n.º 4
0
        public void AddGuitar(string serialNumber, double price, GuitarSpec spec)
        {
            Guitar guitar = new Guitar(serialNumber, price, spec);

            guitars.AddLast(guitar);
        }
Ejemplo n.º 5
0
 public Guitar(string serialNumber, double price, GuitarSpec spec)
 {
     this.SerialNumber = serialNumber;
     this.Price        = price;
     this.Spec         = spec;
 }