Skip to content

Instantly share code, notes, and snippets.

@annibuliful
Created February 4, 2018 10:12
Show Gist options
  • Save annibuliful/767ca56a4882f1d511daa67bc1926ae0 to your computer and use it in GitHub Desktop.
Save annibuliful/767ca56a4882f1d511daa67bc1926ae0 to your computer and use it in GitHub Desktop.
public class BankAccount {
public double balance;
public BankAccount(){
this.balance = 0;
}
public void deposit(double deposit){
this.balance = this.balance + deposit;
}
public void withdraw(double withdraw){
this.balance = this.balance - withdraw;
}
public double getBalance(){
return this.balance;
}
}
public class BankAccountTester {
public static void main(String[] args){
BankAccount account = new BankAccount();
account.deposit(1000);
account.withdraw(500);
account.withdraw(400);
System.out.println(account.getBalance());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment