Exemplo n.º 1
0
        public static void Main(string[] args)
        {
            // Set up Rick's guitar inventory
            Inventory inventory = new Inventory();
            initializeInventory(inventory);

            GuitarSpec whatErinLikes = new GuitarSpec(Builder.FENDER, "Stratocastor",
                Typeg.ELECTRIC, 6, Wood.ALDER, Wood.ALDER);

            List<Guitar> guitars = inventory.search(whatErinLikes);

            if (guitars.Count != 0) {
                Console.WriteLine ("Erin, you might like these guitars:");
                foreach (Guitar guitar in guitars) {
                    GuitarSpec guitarSpec = guitar.Spec as GuitarSpec;

                    Console.WriteLine("  We have a " +
                        guitarSpec.Builder + " " + guitarSpec.Model + " " +
                        guitarSpec.Typeg + " guitar:\n     " +
                        guitarSpec.BackWood + " back and sides,\n     " +
                        guitarSpec.TopWood + " top.\n  You can have it for only $" +
                        guitar.Price + "!\n  ----");
                }
            } else {
                Console.WriteLine("Sorry, Erin, we have nothing for you.");
            }
            Console.ReadKey();
        }