Created
October 22, 2022 12:45
-
-
Save dosu-roseline/6705464e44dd76520645e7183f539019 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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