コード例 #1
0
ファイル: Program.cs プロジェクト: MaddaRooj/the-mall
        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     = "Classic Roll",
                Price    = 3.50,
                Calories = 880
            };
            FoodItem PecanBun = new FoodItem()
            {
                Name     = "Caramel Pecanbon",
                Price    = 6.00,
                Calories = 1080
            };

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

            System.Console.WriteLine("Your Inventory:");
            System.Console.WriteLine(Dollarama.GetFromInventory("mcp").Name);
            System.Console.WriteLine(Cinnabon.GetFromInventory("tcr").Name);
        }
コード例 #2
0
        static void Main(string[] args)
        {
            var Dollarama = new DollarStore();

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

            //Add to inventory of Dallarama
            Dollarama.AddToInventory("MCP", MuiltiColoPen);



            var Cinnabon    = new FoodStore();
            var CinnamonBun = new FoodItem()
            {
                Name     = "Classic Cinnamon Bun",
                Calories = 987,
                Price    = 5.00
            };

            Cinnabon.AddToInventory("Pastry", CinnamonBun);



            Console.WriteLine(Dollarama.GetFromInventroy("MCP").Name);
            Console.WriteLine(Cinnabon.GetFromInventroy("Pastry").Name);
        }