You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Let's represent an ATM with a class containing two attributes: a balance and an interest rate. A newly created account will default to a balance of 0 and an interest rate of 0.1%. Implement the initializer, as well as the following functions:
4
+
Version 1
5
+
6
+
check_balance() returns the account balance
7
+
deposit(amount) deposits the given amount in the account
8
+
check_withdrawal(amount) returns true if the withdrawn amount won't put the account in the negative
9
+
withdraw(amount) withdraws the amount from the account and returns it
10
+
calc_interest() returns the amount of interest calculated on the account
11
+
12
+
Version 2
13
+
Have the ATM maintain a list of transactions.
14
+
Every time the user makes a deposit or withdrawal, add a string to a list saying 'user deposited $15' or 'user withdrew $15'.
15
+
Add a new method print_transactions() to your class for printing out the list of transactions, and add a transactions option to your REPL loop.
0 commit comments