CodShot
C# Public

Bank transaction and balance handling

Manages transactions across multiple banks and retrieves account balances by card or account number.

C#
using System;
using System.Collections.Generic;

namespace HF07
{
    internal class Center
    {
        private List<Bank> bankok;

        public Center(List<Bank> bankok)
        {
            this.bankok = bankok;
        }

        public bool Transaction(string cardNo, int a)
        {
            foreach (Bank b in bankok)
            {
                if (b.HasAccount(cardNo))
                {
                   return b.Transaction(cardNo, a);
                }
            }

            return false;
        }

        public int GetBalance(string accountNum)
        {
            foreach (Bank b in bankok)
            {
                if (b.CheckAccount(accountNum))
                {
                    return b.GetBalance(accountNum);
                }
            }

            return -1;
        }
    }
}

Snippet actions

Pluto
Pluto
Updated: 2026-09-03 13:01
Public snippets
0
Forks
CodShot AI Help
Ask about CodShot features, plans, workspace, AI limits, referrals, and public help topics.
Hi! I can help you understand how CodShot works. What would you like to know?
For account-specific or sensitive issues, please open a support ticket. Open support