Question: ALL IN PYTHON LANGUAGE Problem 8 Write a class BankAccount that takes in a float initial balance initial_balance. The class should have two operations -
ALL IN PYTHON LANGUAGE
Problem 8 Write a class BankAccount that takes in a float initial balance initial_balance. The class should have two operations - a method for deposit and a method for withdraw. These two methods accept an argument amount (a float), specifying how much should be withdrawn or deposited from the account. There should also be a method get_balance, which returns the account's current balance. Depositing an amount should increase the current balance of a bank account, and withdrawing should reduce the current balance of the bank account. A user should not be allowed to withdraw more than what their current balance in their account is. If they do, an exception should be raised (raise any Exception you wish - type does not matter here) Be sure to design your class appropriately - name your attribute representing the account balance appropriately to suggest that a user of the class should not be accessing that attribute directly
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
