public class BankAccount
extends java.lang.Object
| Constructor and Description |
|---|
BankAccount()
Constructs a bank account with a zero balance.
|
BankAccount(double initialBalance)
Constructs a bank account with a given balance.
|
| Modifier and Type | Method and Description |
|---|---|
void |
deposit(double amount)
Deposits money into the bank account.
|
double |
getBalance()
Gets the current balance of the bank account.
|
void |
withdraw(double amount)
Withdraws money from the bank account.
|
public BankAccount()
public BankAccount(double initialBalance)
initialBalance - the initial balancepublic void deposit(double amount)
amount - the amount to depositpublic void withdraw(double amount)
amount - the amount to withdrawpublic double getBalance()