please write the code in python not in java. please keep the code simple. i am l
ID: 3858067 • Letter: P
Question
please write the code in python not in java.
please keep the code simple. i am learning python. use loops.
dont use try and except
Extra Credit: Bank Transaction [20 points] Write a program to isi checking and savings. First, ask for the initial balances of the bank accounts; reject negative balances. Then ask for the transaction; options are deposit and withdrawal. Then ask for the account; options are checking and savings. Then ask for the amount; reject transactions that overdraw an account. At the end, print the balances of both accounts. mulatc a bank transaction. Therc are two bank accounts: sample run 1: Enter the initial balance for checking : 3 Enter the initial balance for savings: 20 Do you want to (D) eposit or (W) ithdraw? Deposit to (C) hecking or (S)avings? c Deposit how much? 200 After the transaction: Savings balance: 2000.0 Checking balance: 3200.0 sample run 2: Enter the initial balance for checking: 2000 Enter the initial balance for savings: 10 Do you want to (D)eposit or (W) ithdraw? W Withdraw to (C)hecking or (S) avings? S Withdraw how much? 3000 You can't do thatthere isn't that much money in the account! After the transaction: Savings balance: 1000.0 Checking balance: 2000.0 sample run 3: Enter the initial balance for checking: 4000 Enter the initial balance for savings: 2000 Do you want to (D)eposit or (W) ithdraw? W Withdraw to (C)hecking or (S) avings? S Withdraw how much? 400 After the transaction: Savings balance: 1600.0 Checking balance: 4000.0 Name the source code file Transaction.py"Explanation / Answer
cbal=int(input("Enter the initial balance for checking :"))
sbal=int(input("Enter the initial balance for savings :"))
ch=input("Do you want to (D)eposit or (W)ithdraw")
if ch=="D" :
ch1=input("Deposit to (C)heckings or (S)avings")
if ch1=="C" :
dc=int(input("Deposit how much ?"))
cbal=cbal+dc
else :
ds=int(input("Deposit how much ?"))
sbal=sbal+ds
else :
ch2=input("Withdraw to (C)heckings or (S)avings")
if ch2=="C" :
wc=int(input("Withdraw how much ?"))
if wc > cbal :
print("You can't do that --- there isn't that much money in the account !")
else :
cbal=cbal-wc
else :
ws=int(input("Withdraw how much ?"))
if ws > sbal :
print("You can't do that --- there isn't that much money in the account !")
else :
sbal=sbal-ws
print("After the Transaction :")
print("Savings Balance :"+str(sbal))
print("Checkings Balance :"+str(cbal))
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.