Question

****USING PYTHON***** Write a program to simulate a bank transaction. There are two bank accounts: checking...

****USING PYTHON*****

Write a program to simulate a bank transaction. There are two bank accounts: checking

and savings. First, ask for the initial balances of the bank accounts; reject negative

balances. Then ask for the transactions; options are deposit, withdrawal, and transfer.

Then ask for the account; options are checking and savings. Reject transactions

that overdraw an account. At the end, print the balances of both accounts

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Code images:

Sample output of Deposit process :

Code :

check = int(input("Initial balance of Checking Ac. :"))
save = int(input("Initial balance of Savings Ac. :"))
if(check < 0 or save < 0):
print("Negative balance is not allowed.")
  
else:
print("*** Trans. Menu ***")
print("1.Deposit.\n2.Withdrawl.\n3.Transfer.")
opt = int(input("Enter your option :"))

#---- Deposit money --------
if(opt == 1):
print("\n*** Choose Account ***")
print("1.Checking.\n2.Savings.")
bank_opt = int(input("Enter your option :"))
if(bank_opt == 1):
amount = int(input("Enter amount"))
check = check + amount
elif(bank_opt == 2):
amount = int(input("Enter amount"))
save = save + amount
else:
print("Invalid input.")

#------- Withdraw money --------
elif(opt == 2):
print("\n*** Choose Account ***")
print("1.Checking.\n2.Savings.")
bank_opt = int(input("Enter your option :"))
if(bank_opt == 1):
amount = int(input("Enter amount"))
if(amount < check):
check = check - amount
else:
print("Insufficent money in your account.")
elif(bank_opt == 2):
amount = int(input("Enter amount"))
if(amount < save):
save = save - amount
else:
print("Insufficent money in your account.")
else:
print("Invalid input.")

#------- Transfer money -------
elif(opt == 3):
print("\n*** Transfer from ***")
print("1.Checking.\n2.Savings.")
bank_opt = int(input("Enter your option :"))
if(bank_opt == 1):
ac_no = int(input("Enter Account No. :"))
amount = int(input("Enter amount"))
if(amount < check):
check = check - amount
print("Transfer Successful.")
else:
print("Insufficent money in your account.")
elif(bank_opt == 2):
ac_no = int(input("Enter Account No. :"))
amount = int(input("Enter amount"))
if(amount < save):
save = save - amount
print("Transfer Successful.")
else:
print("Insufficent money in your account.")
else:
print("Invalid input.")

else:
print("Invalid input.")

print("\n*** Final Balances ***")
print("Checking : ",check)
print("Savings :", save)

Note :

Please follow the indentation (spaces/tab) according to above code images.

Add a comment
Know the answer?
Add Answer to:
****USING PYTHON***** Write a program to simulate a bank transaction. There are two bank accounts: checking...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Java project: A Bank Transaction System For A Regional Bank User Story A regional rural bank...

    Java project: A Bank Transaction System For A Regional Bank User Story A regional rural bank CEO wants to modernize banking experience for his customers by providing a computer solution for them to post the bank transactions in their savings and checking accounts from the comfort of their home. He has a vision of a system, which begins by displaying the starting balances for checking and savings account for a customer. The application first prompts the user to enter the...

  • File: HW2_BankTable.java Write a program that simulates 2 bank transactions. The user will enter: the original...

    File: HW2_BankTable.java Write a program that simulates 2 bank transactions. The user will enter: the original amount in the bank, the money for transaction 1 and the money for transaction 2. If a transaction has a negative number it means that money was removed from bank (an withdrawal). If a transaction has a positive number it means that money was deposited in the bank. Hint: if you add a negative number you are effectively subtracting. E.g. 100 + (-10) =...

  • Java coding help! Write a program to simulate a bank which includes the following. Include a...

    Java coding help! Write a program to simulate a bank which includes the following. Include a commented header section at the top of each class file which includes your name, and a brief description of the class and program. Create the following classes: Bank Customer Account At a minimum include the following data fields for each class: o Bank Routing number Customer First name Last name Account Account number Balance Minimum balance Overdraft fee At a minimum write the following...

  • Assume you are to write a ledger program that keeps track of each bank transaction as...

    Assume you are to write a ledger program that keeps track of each bank transaction as a struct containing the transaction type (deposit or withdrawal), the transaction amount (double), and the balance after the transaction. Would you use an array or a linked list? Why? (in C++)

  • Please do not copy other solution from the site as they never fully implement all the...

    Please do not copy other solution from the site as they never fully implement all the listed guidelines below. Please write a shell script called atm.bash similar to the ones used in ATM machines. Essentially your script is to handle a person's savings and checking accounts and should handle the following services:             Transfer from savings account to checking account             Transfer from checking account to savings account             Cash withdrawal from either account             Balance statements for both the...

  • You are to write a Java program using the following instructions to build a bank-ATM server...

    You are to write a Java program using the following instructions to build a bank-ATM server system with sockets. A bank holds accounts that can have deposits, withdrawals, or retrievals of balance. The bank server provides the account for transactions when a client uses and ATM machine. The ATM asks for the type of transaction and the amount (if needed), then creates a socket connection to the bank to send the transaction for processing. The bank performs the transaction on...

  • C++ Design and implement a hierarchy inheritance system of banking, which includes Savings and Checking accounts...

    C++ Design and implement a hierarchy inheritance system of banking, which includes Savings and Checking accounts of a customer. Inheritance and virtual functions must be used and applied, otherwise, there is no credit. The following features must be incorporated: 1. The account must have an ID and customer’s full name and his/her social security number. 2. General types of banking transactions for both accounts, Checking and Savings: withdraw, deposit, calculate interest (based on the current balance, and if it was...

  • The Checking account is interest free and charges transaction fees. The first two monthly transactions are...

    The Checking account is interest free and charges transaction fees. The first two monthly transactions are free. It charges a $3 fee for every extra transaction (deposit, withdrawal). The Gold account gives a fixed interest at 5% while the Regular account gives fixed interest at 6%, less a fixed charge of $10. Whenever a withdrawal from a Regular or a Checking account is attempted and the given value is higher than the account's current balance, only the money currently available...

  • c++ help please. Savings accounts: Suppose that the bank offers two types of savings accounts: one...

    c++ help please. Savings accounts: Suppose that the bank offers two types of savings accounts: one that has no minimum balance and a lower interest rate and another that requires a minimum balance but has a higher interest rate (the benefit here being larger growth in this type of account). Checking accounts: Suppose that the bank offers three types of checking accounts: one with a monthly service charge, limited check writing, no minimum balance, and no interest; another with no...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT