static void Main(string[] args)
        {
            DollarStore Dollarama = new DollarStore();

            DollarItem MultiColorPen = new DollarItem()
            {
                Name = "Multi Colored Pen with 12 Colors"
            };

            Dollarama.AddToInventory("mcp", MultiColorPen);

            FoodStore Cinnabon = new FoodStore();

            FoodItem ClassicRoll = new FoodItem()
            {
                Name     = "The Classic Roll",
                Price    = 3.50,
                Calories = 880
            };

            FoodItem CaramelPecanbon = new FoodItem()
            {
                Name     = "Caramel Pecanbon",
                Price    = 6,
                Calories = 1080
            };

            Cinnabon.AddToInventory("tcr", ClassicRoll);
            Cinnabon.AddToInventory("cp", CaramelPecanbon);

            Console.WriteLine(Dollarama.GetFromInventory("mcp").Name);
            Console.WriteLine(Cinnabon.GetFromInventory("tcr").Name);
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            // Instance of a dollar store
            DollarStore Dollarama = new DollarStore();

            // Instance of a dollar item
            DollarItem MultiColorPen = new DollarItem()
            {
                Name = "Muli Colored Pen with 12 colors"
            };

            Dollarama.AddToInventory("mcp", MultiColorPen);



            FoodStore Cinnabon = new FoodStore();

            FoodItem Classicroll = new FoodItem()
            {
                Name     = "The Classic Roll",
                Price    = 3.50,
                Calories = 880
            };
            FoodItem CaramelPecanBun = new FoodItem()
            {
                Name     = "Caramel Pecan Bon",
                Price    = 6,
                Calories = 1080
            };

            Cinnabon.AddToInventory("tcr", Classicroll);
            Cinnabon.AddToInventory("cpb", CaramelPecanBun);

            // Prints (the Name of) a dollar item
            System.Console.WriteLine(Dollarama.GetFromInventory("mcp").Name);
            // Prints (the Name of) a food item
            System.Console.WriteLine(Cinnabon.GetFromInventory("tcr").Name);
            System.Console.WriteLine(Cinnabon.GetFromInventory("cpb").Name);
        }