List<Customer> customers = new List<Customer>();
int id = 0;
int click = -1;
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void AddButton_Click(object sender, EventArgs e)
{
Customer rec1 = new Customer("C0020", "Alfred", "Campbelltown", 1500, 2006);
Customer rec2 = new Customer("C0021", "Ryder", "Liverpool", 2000, 2008);
Customer rec3 = new Customer("C0022", "Alison", "Strathfield", 5500, 2012);
Customer rec4 = new Customer("C0023", "Eliza", "Liverpool", 6000, 2012);
Customer rec5 = new Customer("C0024", "Natsu", "Campbelltown", 2560, 2011);
customers.Add(rec1);
customers.Add(rec2);
customers.Add(rec3);
customers.Add(rec4);
customers.Add(rec5);
click = customers.Count - 1;
}
How do i calculate the total balance by particular suburb? I can calculate the total balance of everything by using the code below:
double total = 0;
foreach (Customer Total in customers)
total += Total.Balance; //Total Balance
Any Ideas? thanks