public Call(Gsm caller, Gsm receiver, double duration) { this.Caller = caller; this.Receiver = receiver; this.Duration = duration; }
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!"); } }
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(); }