Project(Minor) Finance Application

Published Aug. 7, 2023, 9:15 a.m.

User-friendly banking project(mini): manage finances with ease. Deposit, withdraw, and check balances conveniently.

The aim of this app is to provide users with a seamless and user-friendly platform for managing their finances. It enables users to easily deposit, withdraw, and check balances, enhancing their financial control and convenience. The app aims to simplify virtual banking and promote efficient financial management.

  1. Introduction

    • Brief description of the banking application.
    • Mention of the bank's user-friendly features.
  2. Bank Features

    • Customer Class:
      • Introduction to the Customer class with banking operations.
      • Explanation of static variable bankname for the bank's name.
  3. Bank Operations

    • Deposit Operation:

      • Explanation of the deposit method.
      • How users can deposit funds to their account.
      • Display of balance after depositing.
    • Withdraw Operation:

      • Explanation of the withdraw method.
      • How users can withdraw funds from their account.
      • Handling of insufficient funds.
  4. Application Flow

    • Welcome Message:

      • Display of the personalized welcome message.
    • Customer Interaction:

      • User input for their name.
      • Creation of a Customer object.
    • Main Menu:

      • Display of menu options for deposit, withdrawal, and exit.
    • User Choice Handling:

      • Processing of user's choice.
      • Execution of corresponding operation.
    • Exit Option:

      • User-friendly exit message upon user's choice.
  5. Usage Scenarios and Outputs

    • Example 1: Depositing and Withdrawing

      • Detailed execution and output of deposit and withdrawal.
    • Example 2: Insufficient Funds

      • Execution and output when attempting to withdraw more than balance.
    • Example 3: Exiting the Program

      • Execution and output when user chooses to exit.
  6. Conclusion

    • Recap of the user-friendly banking application.
    • Encouragement for users to explore and enjoy the banking experience.

This outline provides a structured overview of the features and content included in PyDjangoboy banking application.

Complete Code: 

import sys

# Define the Customer class
class Customer:
    '''Customer class with bank operations..'''
    bankname = 'PyDjangoBank'  # Static variable to store the bank's name

    # Constructor to initialize customer details
    def __init__(self, name, balance=0.0):
        self.name = name
        self.balance = balance

    # Method to deposit funds
    def deposit(self, amt):
        self.balance += amt
        print('Balance after deposit:', self.balance)

    # Method to withdraw funds
    def withdraw(self, amt):
        if amt > self.balance:
            print('Insufficient Funds..cannot perform this operation')
            sys.exit()  # Exit the program if there are insufficient funds
        self.balance -= amt
        print('Balance after withdrawal:', self.balance)

# Welcome message with bank's name
print('Welcome to', Customer.bankname)

# Get customer's name as input
name = input('Enter Your Name:')

# Create a Customer object
c = Customer(name)

# Main loop for banking operations
while True:
    print('d-Deposit\nw-Withdraw\ne-Exit')
    option = input('Choose your option:')

    if option == 'd' or option == 'D':
        amt = float(input('Enter amount:'))
        c.deposit(amt)
    elif option == 'w' or option == 'W':
        amt = float(input('Enter amount:'))
        c.withdraw(amt)
    elif option == 'e' or option == 'E':
        print('Thanks for Banking')
        sys.exit()  # Exit the program when the user chooses to exit
    else:
        print('Invalid option.. Please choose a valid option')

Explanation and Output:

  1. Import sys: Imports the sys module, which provides access to some variables used or maintained by the interpreter and to functions that interact strongly with the interpreter.
  2. Define the Customer class: Defines a class named Customer.
  3. Bank Name: The static variable bankname is set to 'PyDjangoBank', representing the name of the bank.
  4. Constructor: The constructor __init__ is defined to initialize customer details. It takes a name parameter along with an optional balance parameter which defaults to 0.0.
  5. Instance variablesself.name stores the customer's name and self.balance tracks their account funds.
  6. Deposit Method: The deposit method allows the customer to deposit funds into their account. The balance is increased by the deposited amount.
  7. Withdraw Method: The withdraw method allows the customer to withdraw funds from their account. It checks if the withdrawal amount is within the balance and performs the withdrawal if possible.
  8. Welcome Message: Displays a welcome message with the bank's name.
  9. Get Customer's Name: Asks the user to enter their name.
  10. Create Customer Object: Creates an instance of the Customer class with the provided name.
  11. Main Loop: The main loop allows the user to choose banking options repeatedly until they choose to exit.
  12. Menu Options: Displays menu options for deposit, withdrawal, and exit.
  13. User Input: Takes the user's option choice.
  14. Deposit Option: If the user chooses to deposit, they're prompted to enter an amount. The deposit method is then called.
  15. Withdraw Option: If the user chooses to withdraw, they're prompted to enter an amount. The withdraw method is then called.
  16. Exit Option: If the user chooses to exit, the program displays a thank you message and exits.
  17. Invalid Option: If the user enters an invalid option, an error message is displayed.

Outputs Screen:

Example 1: Depositing and Withdrawing

Welcome to PyDjangoBank
Enter Your Name: John
d-Deposit
w-Withdraw
e-Exit
Choose your option: d
Enter amount: 100
Balance after deposit: 100.0
d-Deposit
w-Withdraw
e-Exit
Choose your option: w
Enter amount: 50
Balance after withdrawal: 50.0
d-Deposit
w-Withdraw
e-Exit
Choose your option: e
Thanks for Banking

Example 2: Insufficient Funds

Welcome to PyDjangoBank
Enter Your Name: Alice
d-Deposit
w-Withdraw
e-Exit
Choose your option: d
Enter amount: 200
Balance after deposit: 200.0
d-Deposit
w-Withdraw
e-Exit
Choose your option: w
Enter amount: 300
Insufficient Funds..cannot perform this operation

Example 3: Exiting the Program

Welcome to PyDjangoBank
Enter Your Name: Bob
d-Deposit
w-Withdraw
e-Exit
Choose your option: e
Thanks for Banking

Conclusion

  1. Recap of the User-Friendly Banking Application:

    • Summarize the key features and functionalities of the application.
    • Highlight the convenience and user-friendliness of the banking experience.
  2. Encouragement for Exploration:

    • Invite users to explore and utilize the various banking operations.
    • Emphasize the user-centric design and simplicity of the application.