using System; namespace Banking { public class Account { private static int _nextAccountNumber; private int _accountNumber; private double _balance; public Account() { _accountNumber=_nextAccountNumber; _nextAccountNumber++; } public int AccountNumber { get { return _accountNumber; } } public double Balance { get { return _balance; } set { _balance=value; } } public static void Main(string[] args) { // Current Account #0 CurrentAccount currentAccount=new CurrentAccount(); currentAccount.Balance=100; System.Console.WriteLine("Current Account "+currentAccount.AccountNumber +" has balance "+currentAccount.Balance); // Current Account #1 currentAccount=new CurrentAccount(); currentAccount.Balance=100; currentAccount.directdebit(50); System.Console.WriteLine("Current Account "+currentAccount.AccountNumber +" has balance "+currentAccount.Balance); // Savings Account #1 SavingsAccount savingsAccount=new SavingsAccount(); savingsAccount.Balance=1000; savingsAccount.applyInterest(1.1); System.Console.WriteLine("Savings Account "+savingsAccount.AccountNumber +" has balance "+savingsAccount.Balance); } } public class CurrentAccount : Account { private SavingsAccount _surplusAccount; public double directdebit(double amount) { Balance=Balance-amount; return Balance; } } public class SavingsAccount : Account { public double applyInterest(double rate) { Balance=Balance*rate; return Balance; } } }