Question: Bank Account Application In this assignment, you will create a Python program that simulates a simple bank account using the BAnkAccount class. The program allows
Bank Account Application
In this assignment, you will create a Python program that simulates a simple bank account using the BAnkAccount class. The program allows the user to perform basic Banking operations such as depositing, withdrawing, and checking their account balance.
Here is the UML diagram for a class.
BankAccount
accountNumber
accountName
balance
initaccNo accName, bal
depositbal
withdrawbal
getbalance
str
Create a file, BankAccount.py that implements the BankAccount class.
About UML Diagram
The BankAccount class, holds the account number, account name, and balance as attributesproperties and must implement the following methods:
The init method has parameter variables: self, accNo, accName, and bal. Each of the parameters is assigned to the corresponding objects attribute.
The deposit method has two parameter variables: self and amount. When the method is called, the amount is deposited into the account The value of the parameter is added to the balance attribute
The withdraw method has two parameter variables: self and amount. When the method is called, the amount that is to be withdrawn from the account is passed into the amount parameter. Validation: If the withdrawal amount is greater than the balance amount in the bank, then display the message Insufficient balance
The getbalance method returns the value of the balance attribute.
Implement the str method. It is common practice to define a method that returns a string containing the objects state. In Python, you give this method a special name str The str method displays the account number, name, and balance.
You will next write the Tester program, Accounttest.py
Import the BankAccount class
import BankAccount
Define the main function, In the main function
Get the Account information, account number, name, and balance amount from the user.
Create a BankAccount object.
Deposit the users paycheck. Prompt the user to enter payment for the week. Invoke the deposit function and pass the payment amount.
Display the balance by invoking the getbalance method.
Prompt the user to enter how much they would like to withdraw. Pass the amount to withdraw method for withdrawal.
Display the balance, make sure to format the balance amount to decimal places.
Invoke the str method that displays the state of the object.
Sample output:
Welcome to BankAccount Application!
Enter the account #:
Enter the Account Name: Jane Doe
Enter your starting balance:
How much money would you like to deposit?
I will deposit the amount into your account.
Your balance is $
How much would you like to withdraw?
I will withdraw the amount from your account.
Your balance is $
Your account information:
Account#:
Account Name: Jane Doe
Account Balance:
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
