示例#1
0
        public Call(Gsm caller, Gsm receiver, double duration)
        {
            this.Caller = caller;

            this.Receiver = receiver;

            this.Duration = duration;
        }
示例#2
0
        public void MakeCall(Gsm receiver, double duration)
        {
            if (Call.IsValidDuration(duration) &&
                this.HasSimCard && receiver.HasSimCard &&
                this.SimMobileNumber != receiver.SimMobileNumber)
            {
                Call currentCall = new Call(this, receiver, duration);
                this.LastOutgoingCall = currentCall;

                receiver.LastIncomingCall   = currentCall;
                this.OutgoingCallsDuration += duration;
            }
            else
            {
                Console.WriteLine("Cannot make call!");
            }
        }
示例#3
0
        static void Main(string[] args)
        {
            Call.PricePerMinute = 10;

            Gsm mishoGsm = new Gsm("Samsung");

            mishoGsm.InsertSimCard("0893456789");
            Gsm svetlioGsm = new Gsm("NOKIA");

            svetlioGsm.InsertSimCard("0893456780");

            mishoGsm.MakeCall(svetlioGsm, 10);

            Console.WriteLine(mishoGsm.SumForCalls);
            Console.WriteLine(svetlioGsm.SumForCalls);

            mishoGsm.PrintInfoForTheLastIncomingCall();
            mishoGsm.PrintInfoForTheLastOutgoingCall();
            svetlioGsm.PrintInfoForTheLastIncomingCall();
            svetlioGsm.PrintInfoForTheLastOutgoingCall();

            Console.ReadKey();
        }