0% found this document useful (0 votes)
27 views

Project Code

Uploaded by

ksoniji7336
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views

Project Code

Uploaded by

ksoniji7336
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 7

import random

import re

from datetime import datetime

class SBIBank:

def _init_(self):

self.accounts = {}

def print_centered(self, text, width=80):

"""Helper function to print text centered within a specific width."""

print(text.center(width))

def main_menu(self):

# Center the bank welcome message

self.print_centered("Welcome To SBI BANK")

# Course of action header

self.print_centered("Select Your Preferred Course Of Action")

# Print the options left-aligned (as you requested)

print("\n[A] Create an Account")

print("[B] Proceed in existent Account")

print("[C] Proceed in ATM")

print("[D] Exit from SBI BANK")

choice = input("Enter your choice: ").upper()

if choice == 'A':

self.create_account()
elif choice == 'B':

self.proceed_existent_account()

elif choice == 'C':

self.proceed_atm()

elif choice == 'D':

print("Thank you for visiting SBI BANK!")

else:

print("Invalid choice. Please try again.")

def create_account(self):

# Account opening form header

self.print_centered("Account Opening Form For Resident Individual")

# CIF header

self.print_centered("Customer Information Sheet [CIF Creation / Amendment]")

account_data = {}

# Automatically set today's date

today_date = datetime.now().strftime("%d/%m/%Y")

account_data['Date'] = today_date

print(f"Today's Date: {today_date}")

account_data['Branch Name'] = "Ganesha Nagar"

account_data['Branch Code'] = "GNID" + ''.join([str(random.randint(0, 9)) for _ in range(8)])

account_data['Customer ID'] = ''.join([str(random.randint(0, 9)) for _ in range(12)])

account_data['Account No.'] = ''.join([str(random.randint(0, 9)) for _ in range(15)])

# User input
account_data['Name'] = input("Enter your name: ")

# Gender validation

while True:

account_data['Gender'] = input("Enter your gender (Male / Female / Other): ").capitalize()

if account_data['Gender'] in ['Male', 'Female', 'Other']:

break

else:

print("Invalid input, please enter Male, Female, or Other.")

# Date of Birth and age validation

while True:

dob = input("Enter your date of birth (dd/mm/yyyy): ")

try:

birth_date = datetime.strptime(dob, "%d/%m/%Y")

today = datetime.now()

# Calculate age considering whether the birthday has passed this year

age = today.year - birth_date.year - ((today.month, today.day) < (birth_date.month,


birth_date.day))

if age >= 18:

account_data['Date of Birth'] = dob

break

else:

print(f"You must be at least 18 years old to open an account. Your current age is {age}.")

except ValueError:

print("Invalid date format. Please enter in dd/mm/yyyy format.")


# Marital status validation

while True:

account_data['Marital Status'] = input("Enter your marital status (Married / Unmarried / Others):


").capitalize()

if account_data['Marital Status'] in ['Married', 'Unmarried', 'Others']:

break

else:

print("Invalid input, please enter Married, Unmarried, or Others.")

account_data['Father/Mother/Spouse Name'] = input("Enter the name of Father/Mother/Spouse: ")

# Nationality validation

while True:

account_data['Nationality'] = input("Enter your nationality (In-India / Others): ").capitalize()

if account_data['Nationality'] == 'Others':

account_data['Country Name'] = input("Enter your country name: ")

break

elif account_data['Nationality'] == 'In-India':

break

else:

print("Invalid input, please enter In-India or Others.")

account_data['Occupation Type'] = input("Enter your occupation (State Govt / Central Govt / Public
Sector / Defence / Pvt. Sector): ")

# Annual income validation

while True:

try:

account_data['Annual Income'] = float(input("Enter your annual income (in Rs): "))


if account_data['Annual Income'] >= 0:

break

else:

print("Annual income must be a positive number.")

except ValueError:

print("Invalid input, please enter a numeric value.")

# Mobile number validation

while True:

mobile = input("Enter your mobile number: ")

if re.match(r'^\d{10}$', mobile):

account_data['Mobile No.'] = mobile

break

else:

print("Invalid mobile number, please enter a 10-digit number.")

account_data['Address'] = input("Enter your address: ")

account_data['City/District/State'] = input("Enter your city, district, and state: ")

# Account type validation

while True:

account_data['Account Type'] = input("Enter the type of account (Saving / Current): ").capitalize()

if account_data['Account Type'] in ['Saving', 'Current']:

break

else:

print("Invalid input, please enter Saving or Current.")

account_data['Nomination Name'] = input("Enter nomination's name: ")


# Nomination mobile validation

while True:

nom_mobile = input("Enter nomination's mobile number: ")

if re.match(r'^\d{10}$', nom_mobile):

account_data['Nomination Mobile No.'] = nom_mobile

break

else:

print("Invalid mobile number, please enter a 10-digit number.")

account_data['Verification Proof'] = input("Enter your verification proof (Aadhaar Card / PAN Card /
etc.): ")

account_data['Account Opening Amount'] = input("Enter the account opening amount: ")

account_data['PIN'] = ''.join([str(random.randint(0, 9)) for _ in range(4)])

account_data['Signature'] = input("Please sign here: ")

# Save account

self.accounts[account_data['Account No.']] = account_data

# Display generated account information

print("\nAccount successfully created!")

print("Here are the details of your account:")

for key, value in account_data.items():

print(f"{key}: {value}")

print("\nAfter the creation of the account, you will get a bank Pass Book in 72 hours.")

print("If you don't get it then contact customer care.\n")

def proceed_existent_account(self):
print("\nProceeding in existing account... (Feature not yet implemented)")

def proceed_atm(self):

print("\nProceeding in ATM... (Feature not yet implemented)")

# Running the Bank system

if _name_ == "_main_":

sbi_bank = SBIBank()

sbi_bank.main_menu()

You might also like