OOP Project: Bank Account- Python

OOP projects: (object-oriented programming) they are the fundamental needs of industry- level projects!
This is a simple program that is used to mock a bank account that has withdraw & deposit functions. If you are in the fin-tech space or just a developer wanting a refresher program. Then this project will help you on your OOP skills & implement basic python functions.
What we need to include:
Parent Class: User Information
- this is where the details for user is stored
- includes functions for the user details
Child Class: Bank Information
- this is where the details for account balance is stored
- this is where the details for the amount is stored
- it allows for withdrawal, deposits & you can view the balance
Open up your IDE (I used VSC). You can either just copy the code below or customize it as you like & use it as a template!
#Parent Class
class User()Ni:
def __init__(self,name,age,gender):
self.name = name
self.age = age
self.gender = gender
def show_details(self):
print("Personal Details")
print("")
print("Name ", self.name)
print("Age ", self.age)
print("Gender ", self.gender)
#Child Class
class Bank(User):
def __init__(self,name,age,gender):
super().__init__(name,age,gender)
self.balance = 0
def deposit(self,amount):
self.amount = amount
self.balance = self.balance + self.amount
print("Account balance has been updated : $", self.balance)
def withdraw(self,amount):
self.amount = amount
if self.amount > self.balance:
print("Insufficient Funds | Balance Available : $", self.balance)
else:
self.balance = self.balance - self.amount
print("Account balance has been updated : £", self.balance)
def view_balance(self):
self.show_details()
print("Account balance: $", self.balance)
def cont():
input("\n\nPress enter to continue\n\n")
exit = 0
while True:
name = Bank(input("Enter name: "), int(input("Enter Age: ")), input("Enter Gender: "))
options = input("\n\nwhat would you like to do (enter a number)?\n\n1. Withdraw\n2. Deposit\n3. View Account summary\n4. view balance\n5. Exit \n>>")
if options == '5':
exit = 1
break
if options == '3':
name.show_details()
cont()
elif options == '4':
name.view_balance()
cont()
elif options == "1":
name.withdraw(int(input("How much would you like to withdraw?: ")))
cont()
elif options == "2":
name.deposit(int(input("How much would you like to deposit?: ")))
cont()
I hope you enjoyed this quick & simple OOP Python program!
Drop a comment if you tried it out & customized it ☺️.
Let’s Connect!

My Linkedin profile: https://www.linkedin.com/in/janita-williamson

My GitHub username: MrsTorres https://github.com/MrsTorres/python-.git

A visual diary of my coffee induced journey transitioning from healthcare to the tech world! @caffeinatedtechie
More content at PlainEnglish.io.
Sign up for our free weekly newsletter. Follow us on Twitter, LinkedIn, YouTube, and Discord.
Interested in scaling your software startup? Check out Circuit.