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


C# GSM.MakeCall方法代码示例

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


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

示例1: Main

    static void Main(string[] args)
    {
        GSM phone = new GSM("lala", "sumsAng", "batman", 10000.99);

        phone.MakeCall(DateTime.Now, "0899999999", 3.44);
        phone.MakeCall(DateTime.Now.AddHours(3), "0899999999", 3.44);
        phone.MakeCall(DateTime.Now.AddDays(99), "0889666999", 9.44);
        phone.MakeCall(DateTime.Now.AddDays(5).AddHours(10), "0009666999", 9.44);

        Console.WriteLine("Calls ordered by date: ");
        foreach (DateTime timeOfCall in phone.GetCallsByDate())
        {
            Console.WriteLine(timeOfCall.ToString());
        }

        phone.DeleteCall(2);
        Console.WriteLine("New calls: ");
        foreach (DateTime timeOfCall in phone.GetCallsByDate())
        {
            Console.WriteLine(timeOfCall.ToString());
        }

        phone.ClearCallHistory();
        Console.WriteLine("\nNothing will show, because history is deleted: ");
        foreach (DateTime timeOfCall in phone.GetCallsByDate())
        {
            Console.WriteLine(timeOfCall.ToString());
        }
    }
开发者ID:Dyno1990,项目名称:TelerikAcademy-1,代码行数:29,代码来源:AddDeleteHistory.cs

示例2: Main

    static void Main(string[] args)
    {
        GSM phone = new GSM("lala", "sumsAng", "batman", 10000.99);

        phone.MakeCall(DateTime.Now, "0899999999", 3.44);
        phone.MakeCall(DateTime.Now.AddHours(3), "0899999999", 3.44);
        phone.MakeCall(DateTime.Now.AddDays(99), "0889666999", 9.44);
        phone.MakeCall(DateTime.Now.AddDays(5).AddHours(10), "0009666999", 9.44);

        Console.WriteLine("Calls ordered by date: ");
        foreach (DateTime timeOfCall in phone.GetCallsByDate())
        {
            Console.WriteLine(timeOfCall.ToString());
        }
    }
开发者ID:Dyno1990,项目名称:TelerikAcademy-1,代码行数:15,代码来源:AddCallHistory.cs

示例3: Main

    static void Main(string[] args)
    {
        GSM phone = new GSM("lala", "sumsAng", "batman", 10000.99);

        phone.MakeCall(DateTime.Now, "0899999999", 3.44);

        Console.WriteLine(phone.ShowCall().ToString());
    }
开发者ID:Dyno1990,项目名称:TelerikAcademy-1,代码行数:8,代码来源:CallClass.cs

示例4: Main

    static void Main()
    {
        //Test task 4
        GSM iPhone = new GSM("iPhone4s", "Apple");

        //Console.WriteLine(iPhone.ToString());

        //Task 7
        GSM[] phoneStore = new GSM[]
        {
            new GSM("N95","Nokia",123, "nobody", new Battery("1200",105,43), new Display(8d,16000000)),
            new GSM("X200","Samsung"),
            new GSM("eXperia","Sony",500)
        };

        //Sell a phone to Bai Pesho
        phoneStore[0].Owner = "Bai Pesho";

           // Console.WriteLine("Phones in Store:");
        foreach (var phone in phoneStore)
        {
            //Console.WriteLine(phone);
        }

        //Console.WriteLine(GSM.IPhone4S);

        GSM workPhone = new GSM("210", "Huavei", 5, "worker");
        workPhone.MakeCall(883555555, 150);
        workPhone.MakeCall(883556555, 190);
        workPhone.MakeCall(883566645, 212);

        foreach (var call in workPhone.CallHistory)
        {
            Console.WriteLine("Call to {0},  duration: {1}",call.PhoneNumber,call.CallDuration);
        }

        //Print Total Cost
        Console.WriteLine("Total Cost: " + workPhone.CalculateTotalPrice(0.37m));

        //Find and remove longest call
        ;
        ulong maxDuration = ulong.MinValue;

        foreach (var call in workPhone.CallHistory)
        {
            if (call.CallDuration>maxDuration)
            {
                maxDuration = call.CallDuration;
            }
        }

        if (maxDuration != ulong.MinValue)
        {
            workPhone.RemoveCallByDuration(maxDuration);
            Console.WriteLine();
            Console.WriteLine("Removed call with duration: " + maxDuration);
        }

        //Print Total Cost without longest duration

        Console.WriteLine("Total Cost: " + workPhone.CalculateTotalPrice(0.37m));
        Console.WriteLine();

        foreach (var call in workPhone.CallHistory)
        {
            Console.WriteLine(call.ToString());
        }

        workPhone.ClearCallHistory();
        //Print again
        Console.WriteLine("Call History: ");
        foreach (var call in workPhone.CallHistory)
        {
            Console.WriteLine(call.ToString());
        }
        //
    }
开发者ID:nkolarov,项目名称:telerik-academy,代码行数:77,代码来源:GSMCallHistoryTest.cs


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