public void DeleteEntry(Call entry) { callHistory.Remove(entry); }
static void Main(string[] args) { GSM newGSM = new GSM("Samsung", "Note III", 1400, "Me", new Battery("ChinaMax", 240, 120), new Display(5, "123j", 256)); Call firstCall = new Call("0888888888", 124); Call secondCall = new Call("0888888888", 13); Call thirdCall = new Call("0888888888", 56); newGSM.AddEntry(firstCall); newGSM.AddEntry(secondCall); newGSM.AddEntry(thirdCall); foreach (Call call in newGSM.CallHistory) { StringBuilder sb = new StringBuilder(); sb.Append("The date of the call is : " + call.DateOfCall + "\nThe time of the call is : " + call.TimeOfCall + "\nContacted phone number : " + call.DailedPhoneNumber + "\nThe duration of the call is : " + call.DurationOfCall + " minutes\n"); Console.WriteLine(sb); } newGSM.PhoneBillForAllCalls(0.37M); newGSM.DeleteEntry(firstCall); newGSM.PhoneBillForAllCalls(0.37M); newGSM.ClearCallHistory(); foreach (Call call in newGSM.CallHistory) { StringBuilder sb = new StringBuilder(); sb.Append("The date of the call is : " + call.DateOfCall + "\nThe time of the call is : " + call.TimeOfCall + "\nContacted phone number : " + call.DailedPhoneNumber + "\nThe duration of the call is : " + call.DurationOfCall + " minutes\n"); Console.WriteLine(sb); } }
public void AddEntry(Call entry) { callHistory.Add(entry); }