using System; namespace Banking { public static void Main(string []args) { } //A bank account has a balance //that can be changed with // withdraw or deposit. public class BankAccount { private double balance; //constructs a bank account // with zero balance public BankAccount() { balance = 0; } //Constructs a bank account //with a given balance //(initalBalance) public BankAccount(double initialBalance) { balance = initialBalance; } //Deposits money into the bank account. //(amount the amount to deposit) public void Deposit(double amount) { double newBalance = balance + amount; balance = newBalance; } //Withdraws money from the bank account //(the amount to withdraw) public void Withdraw(double amount) { double newBalance = balance - amount; balance = newBalance; } //Gets the current balance of the bank account. //(returns the current balance) public double GetBalance() { Console.ReadLine(); return balance; } } }
public static void Main(string []args) { }
public class BankAccount
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)