当前位置: 首页>>代码示例>>C#>>正文


C# Invoice.InsertItem方法代码示例

本文整理汇总了C#中Invoice.InsertItem方法的典型用法代码示例。如果您正苦于以下问题:C# Invoice.InsertItem方法的具体用法?C# Invoice.InsertItem怎么用?C# Invoice.InsertItem使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Invoice的用法示例。


在下文中一共展示了Invoice.InsertItem方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Main

        static void Main(string[] args)
        {
            //test the item class
            Console.WriteLine("\n*****Testing the Item Class");
            Console.WriteLine(new Item("Mouse", 5.21));
            Console.WriteLine(new Item("Keybaord", 14.99, 4));
            Console.WriteLine(new Item("Monitor", 124.98, 2, true));

            //test the invoice class
            Console.WriteLine("\n*****Testing the Invoice Class");
            Console.WriteLine(new Invoice("Narendra Pershad", "647-124-5678"));

            //testing AddItem method of the invoice class
            Console.WriteLine("\n*****Testing the AddItem()");
            Invoice inv0 = new Invoice("Manraj Gill", "647-123-4567");
            inv0.InsertItem(new Item("Crucial SSD", 199.97, 5));
            inv0.InsertItem(new Item("Samsung Led Monitor", 7, 4, true));
            inv0.InsertItem(new Item("GeForce GTX", 28, 6, true));
            inv0.InsertItem(new Item("Sapphire Radeon", 14, 12, true));

            Console.WriteLine(inv0);

            Console.WriteLine("\n*****Testing the AddItem()");
            Invoice inv1 = new Invoice("Andre Levy", "416-289-5000");
            inv1.InsertItem(new Item("Netgear Router", 7, 1, true));
            inv1.InsertItem(new Item("Asus Router", 21));
            inv1.InsertItem(new Item("Samsung Galaxy", 56, 2, true));
            inv1.InsertItem(new Item("Asus MeMO Pad", 42, 3, true));
            inv1.InsertItem(new Item("Lenovo Tablet", 7));
            inv1.InsertItem(new Item("Ematic Tablet", 21));

            Console.WriteLine(inv1);

            //testing the RemoveItem method of the invient class
            //check the previous display to verify that atleast
            //two of the item numbers are used below
            Console.WriteLine("\n*****Testing the RemoveItem()");
            inv1.RemoveItem("108");
            inv1.RemoveItem("109");
            inv1.RemoveItem("108");
            Console.WriteLine(inv1);
        }
开发者ID:kpuno,项目名称:COMP-123,代码行数:42,代码来源:Program.cs


注:本文中的Invoice.InsertItem方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。