Question: Q6 - Classes I: BankAccount () (2.5 points) Write a class called BankAccount. It will store the following information as instance attributes: - account_number: int

Q6 - Classes I: BankAccount () (2.5 points) Write a class called BankAccount. It will store the following information as instance attributes: - account_number: int - account_holder_name :str - balance : int or float, default is 0 if not set by user The initializer for the class will take the arguments above in this exact order The class should have methods called deposit() and withdraw () that allow the user to deposit or withdraw money from the account. The class should also have a method called account_summary () that prints the current balance of the account. Here is a detailed description of the class methods. We do not show the arguments explictly, but you should be able to figure them out from the descriptions here plus what you know about how classes work. - initializes the class instance as described above - deposit( ) - takes an argument money (int or float) that will be added into the balance of this account. - Checks if money is a negative number, and if so returns False immediately (no other action performed) to indicate the failure of this action. - Otherwise, add money to the account balance then return True to indicate the success of this action. - withdraw ( ) - takes an argument money (int or float) that will be removed from the balance of this account. - Checks if money is a negative number or if money exceeds the balance of the account. If so returns performed) to indicate the failure of this action. - Otherwise, remove money from the balance then return to indicate success. - account_summary() - takes no input arguments. - returns current account information as a string using the prototype shown below. In making the string you would replace things like variable_name with the contents of the variable. "Hi, account_holder_name. The total balance of your account is $ balance. Thank you!" For example, a valid return for a particular account might be: "Hi, Alice. The total balance of your account 123456789 is $1969.07. Thank you!" - Note: please pay attention to punctuation and whitespace when creating the string. - Note: please use good coding style (doesn't have to be perfect, but it has to be pretty decent)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
