Answered step by step
Verified Expert Solution
Question
1 Approved Answer
PLE HElP ME BY PYTHON HELP ME PYTHON!! In this project, you will write two files: a class that represents a bank account and a
PLE HElP ME BY PYTHON
HELP ME PYTHON!!
In this project, you will write two files: a class that represents a bank account and a program that works ike an ATM for bank accounts. The Bank Account Class In a file named account.py, create an Account class. An account object has these attributes: acct_number : the account number (an integer) name : the account holder's name pin : the account holder's PIN, which is a four-character string, since it can have leading zeros. balance : the current balance in the account, which is a float. Implement these methods: _init_(self, acct_number, name, pin, balance) The constructor str_(self) Returns a string giving the account ID, name, PIN, and balance, separated by colons. Do not use format() on the balance; you want to keep the number as accurate as possible. deposit(self, amount) Adds the given amount (a float ) to the current balance. If the amount is negative, the balance must not be changed; otherwise, the balance attribute is updated to reflect the deposit. This method returns the updated balance. withdraw(self, amount) Withdraws the given amount (a float ) from the current balance. If the amount is negative or greater than the current balance, the balance must not be changed; otherwise, the balance attribute is updated to reflect the withdrawal. This method returns the updated balance. Note that deposit() and withdraw() do not print error messages if they get incorrect input; they simply ignore it. It is up to the program that calls these functions to provide the error messages for the user of the program. Sample Output Here is what your program output might look like: Enter account number (or ENTER to quit): 12345 Invalid account number. Enter account number (or ENTER to quit): 10626 Enter a 4-digit PIN: 1111 Enter a 4-digit PIN: 2222 Enter a 4-digit PIN: 3333 Sorry, could not validate you as a customer. Enter account number (or ENTER to quit): 10626 Enter a 4-digit PIN: 6717 Welcome, Roz Chast! Your current balance is $1853.22. D)eposit, W)ithdraw, or F)inish: d Enter amount to deposit: $-5 Amount cannot be negative. Enter amount to deposit: $1000 Your balance is now $2853.22 D) eposit, W)ithdraw, or F)inish: w Enter amount to withdraw: $2870 Amount cannot be negative or greater than balance. Enter amount to withdraw: $500.11 Your balance is now $2353.11 D)eposit, W)ithdraw, or F)inish: f Thank you for banking with us, Roz ChastStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started