Skip to content

Instantly share code, notes, and snippets.

@dosu-roseline
Created October 22, 2022 12:45
Show Gist options
  • Save dosu-roseline/6705464e44dd76520645e7183f539019 to your computer and use it in GitHub Desktop.
Save dosu-roseline/6705464e44dd76520645e7183f539019 to your computer and use it in GitHub Desktop.
void main() {
var customerAccount = Bank('Dosu Roseline', 101110101, 500000);
print(customerAccount.availableBalance());
print( customerAccount.deposit(0));
print(customerAccount.withdrawal(5000000));
}
class Bank{
String? accountName;
int? accountNumber;
int accountBalance = 0;
Bank(this.accountName, this.accountNumber, this.accountBalance);
availableBalance() {
return 'Available blance is $accountBalance';
}
deposit(int amount) {
print('Money deposited successfully');
return accountBalance += amount;
}
withdrawal(int amount) {
if(amount > accountBalance) {
print('Insufficient Funds!');
}
return accountBalance -= amount;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment