public GSM(string model, string manufacturer) { this.model = model; this.manufacturer = manufacturer; this.price = 0; this.owner = null; this.battery = null; this.display = null; iPhone = new IPhone4S("black"); this.call = null; }
static void Main(string[] args) { GSM nokia = new GSM("lumia", "nokia", 900, "Stoyan", new Battery("Asperji", 30, 0, Battery.BatteryType.NiMH), new Display("366x512", 16000000)); nokia.AddCall(new Call("02.04.2015", "02:22:32", "0884239123", (long)340)); nokia.AddCall(new Call("01.10.2015", "12:12:42", "0884232345", (long)245)); nokia.AddCall(new Call("02.04.2015", "15:33:12", "0889123242", (long)45)); //display info for each call foreach (var call in nokia.callHistory) { Console.WriteLine(call.ToString()); Console.WriteLine(); } //total price of calls Console.WriteLine("Total price of all calls (0.37 per minute) : " + nokia.TotalPriceOfCalls(0.37m)); Console.WriteLine(); long? max = 0; Call c = new Call(); foreach (Call call in nokia.callHistory) { if (call.Duration > max) { max = call.Duration; c = call; } } nokia.callHistory.Remove(c); Console.WriteLine("Total price of all calls after removal (0.37 per minute) : " + nokia.TotalPriceOfCalls(0.37m)); nokia.callHistory.Clear(); //print after removal of all elements foreach (var call in nokia.callHistory) { Console.WriteLine(call); } Console.WriteLine(); }
public void AddCall(Call call) { this.callsList.Add(call); }
public void RemoveCall(Call call) { this.callHistory.Remove(call); }
public void AddCall(Call call) { if (call != null) { this.callHistory.Add(call); } else { Console.WriteLine("Null reference exception"); Environment.Exit(0); } }
public Call LongestCall() { Call tempCall = new Call(); for (int i = 0; i < callHystory.Count; i++) { if(callHystory[i].CallDuration > tempCall.CallDuration) { tempCall = callHystory[i]; } } return tempCall; }
public void AddCall(Call call) { this.callHistory.Add(call); }
public void DeleteCallFromhistory(Call call) { Call.CallHystory.Remove(call); }
public void AddCallInHistory(Call call) { Call.CallHystory.Add(call); }