[Solved] I’m stuck on this Banking System console application C# [closed]


You will need to implement the following:

public Customer findCustomer(int id) {
    for (int i = 0; i < Bank.AllCustomers.Count(); i++) {
        if (Bank.AllCustomers.ElementAt(i).Id == id) return Bank.AllCustomers.ElementAt(i);
    }
    return null; //Not found
}

This will simplify your life, because when you want to add/subtract money to a given account, or remove it, or edit it, you will need to first find it.

public void transfer(Customer sender, Customer receiver, float amount) {
    if ((sender != null) && (receiver != null)) {
        //Existent user
        if ((amount > 0) && (sender.Money >= amount)) {
            //Valid amount
            sender.Money -= amount;
            receiver.Money += amount;
        }
    }
}

public void transfer(int fromID, int toID, float amount) {
    Customer sender = findCustomer(fromID);
    Customer receiver = findCustomer(fromID);
    transfer(sender, receiver, amount);
}

You will need to find the Customer to edit and remove. All these are well documented and should be easy to implement if you are able to find a Customer by Id.

2

solved I’m stuck on this Banking System console application C# [closed]