Example #1
0
        static void Main(string[] args)
        {
            ConvertToString convert   = new ConvertToString();
            Inventory       inventory = new Inventory();

            InitializeInventory(inventory);
            GuitarSpec WhatErinLikes = new GuitarSpec(Builder.FENDER, "Stratocastor",
                                                      Type.ELECTRIC, 6, Wood.ALDER, Wood.ALDER);
            List <Instrument> MatchingGuitars = inventory.Search(WhatErinLikes);

            if (MatchingGuitars.Count >= 0)
            {
                Console.WriteLine("Erin, you might like these guitars :");

                foreach (Guitar guit in MatchingGuitars)
                {
                    GuitarSpec spec = (GuitarSpec)guit.Spec;
                    Console.WriteLine("We have a " + convert.BuilderToString(spec.Builder) +
                                      " " + spec.Model + " " + convert.TypeToString(spec.Type) + " " +
                                      convert.WoodToString(spec.Backwood) + " Back and Sides " +
                                      convert.WoodToString(spec.Topwood));

                    Console.WriteLine("You can have it for just $" + guit.Price);
                }
            }
            else
            {
                Console.WriteLine("Sorry, we nothing for you....");
            }
            MandolinSpec WhatAkashLikes = new MandolinSpec(Builder.COLLINGS, "Stratocastor",
                                                           Type.ACOUSTIC, Style.A, Wood.ADIRONDACK, Wood.ADIRONDACK);
            List <Instrument> MatchingMandolins = inventory.Search(WhatAkashLikes);

            if (MatchingMandolins.Count >= 0)
            {
                Console.WriteLine("Erin, you might like these mandolin :");


                foreach (Mandolin mandolin in MatchingMandolins)
                {
                    MandolinSpec spec = (MandolinSpec)mandolin.Spec;
                    Console.WriteLine("We have a " + convert.BuilderToString(spec.Builder)
                                      + " " + spec.Model + " " + convert.TypeToString(spec.Type) + " " +
                                      convert.WoodToString(spec.Backwood) + " Back and Sides " +
                                      convert.WoodToString(spec.Topwood));

                    Console.WriteLine("You can have it for just $" + mandolin.Price);
                }
            }
            else
            {
                Console.WriteLine("Sorry, we nothing for you....");
            }
        }
Example #2
0
        static void Main(string[] args)
        {
            Inventory inventory = new Inventory();

            InitializeInventroy(inventory);
            GuitarSpec whatErinLikes   = new GuitarSpec(Builder.FENDER, "Stratocastor", Type.ELECTRIC, 12, Wood.ALDER, Wood.ALDER);
            ArrayList  matchingGuitars = inventory.Search(whatErinLikes);

            if (matchingGuitars.Count >= 0)
            {
                Console.WriteLine("Erin,you might like these guitars:");
                foreach (Guitar guitar in matchingGuitars)
                {
                    GuitarSpec      spec = guitar.GetSpec();
                    ConvertToString c    = new ConvertToString();
                    Console.WriteLine("\nWe have a " + c.BuilderToString(spec.GetBuilder()) + " " + spec.GetModel() + " " + spec.Getnumstring() + " String " +
                                      c.TypeToString(spec.Gettype()) + " guitar:\n    " +
                                      c.WoodToString(spec.GetBackwood()) + " back and sides,\n    " +
                                      c.WoodToString(spec.GetTopwood()) + " top. \n You cac have it for only $" +
                                      guitar.GetPrice() + "!\n  ----");
                }
            }
            else
            {
                Console.WriteLine("Sorry, Erin We have nothing for you!");
            }
        }