In: Computer Science
You will write a program using Python that simulates an Automatic Teller Machine (ATM). For this program, your code can have user defined functions (but not required), the program must not call on any external functions or modules to handle any of the input, computational, and output requirements.
Requirements:
There is a customer with the following credential and can only access the system if the Access Code is correct:
• Name: Peter Parker, Access Code: 2222
• When the program starts, the customer has two account types. That is a Checking Account and Savings Account with balances starting with $1000 for Checking and $2000 for Savings.
• When the program starts, customer credentials and accounts starting amounts must be processed and stored before the customer interacting with the system.
Customer Main Choices (Sub-menu choices based on the type of transactions)
1) View Balance
2) Deposit
3) Withdraw
4) Exit
Account Processing Restrictions:
a) The balances of each account type must be updated base on selected customer choices.
b) The customer can choose to withdraw from the Checking and Savings accounts but can only withdraw if there is enough money in the accounts to meet the withdrawal request. When making a Withdraw, the customer must be presented with an appropriate message to show the withdrawing account's balance before completing such a transaction.
c) When making a withdrawal from the Saving account, a fee is charged and reflected in the Saving account (0.02% of the total amount transfer). The fee must be displayed as part of the output when the customer performs this operation.
d) When the request to View Balance, the appropriate output must display the balance for each account type and the accounts' total balance.
e) The system will not accept a deposit > $500.
f) The customer cannot deposit, withdraw, or transfer partial currency (ex: $100 is valid. $100.50 is invalid).
Additional Requirements:
1) Appropriate introduction statements (s) (output) to the customer for the purpose and options when the program starts
2) Appropriate statement (s) to the customer to capture all input requirements as per program requirements
3) Properly tested to valid customer/admin input. Also, appropriate and detail messages for invalid input.
4) Appropriate formatted output
5) The program runs in a continuous loop until the admin chooses to quit. For this program, we will assume that customers will not use the quit option. It will be used to test your program thoroughly. Hence, include the quit option, but do not make it evident as one of the listed customer choices.
6) Meets correct code format and structure requirements
def start():
global checking_bal, savings_bal
print('\nAccount Holder: Peter Parker')
print('Access Code: 2222')
print('Checking Account balance: $',checking_bal)
print('Savings Account balance: $',savings_bal)
print('\nPress:\na) v for View Balance\nb) d for Deposit\nc) w for
Withdraw\nd) e for Exit')
choice = input()
if(choice == 'v' or choice == 'V'):
print('Account Holder: Peter Parker')
print('Access Code: 2222\n')
print('Checking Account balance: $',checking_bal)
print('\nSavings Account balance: $',savings_bal)
print('\nTotal balance: $', checking_bal+savings_bal)
print('\n\n\n')
start()
elif(choice == 'd' or choice == 'D'):
while(True):
print('\nPress:\n S to deposit in savings account \n C to deposit
in checking account')
account = input()
if( account == 'S' or account == 's'):
while(True):
deposit_amount = input('Enter amount to be deposited: $')
if('.' in deposit_amount and
int(deposit_amount[deposit_amount.index('.')+1:])>0):
print('Enter amount without any decimal value')
continue
deposit_amount=int(deposit_amount)
if(deposit_amount<=500):
savings_bal = savings_bal + deposit_amount
print('--'*10)
print('Amount deposited successfully')
print('--'*10)
start()
else:
print('Enter a amount less than $500')
elif( account == 'c' or account == 'C'):
while(True):
deposit_amount = input('Enter amount to be deposited: $')
if('.' in deposit_amount and
int(deposit_amount[deposit_amount.index('.')+1:])>0):
print('Enter amount without any decimal value')
continue
deposit_amount=int(deposit_amount)
if(deposit_amount<=500):
checking_bal = checking_bal + deposit_amount
print('--'*10)
print('Amount deposited successfully')
print('--'*10)
start()
else:
print('Enter a amount less than $500')
else:
print('Enter correct option')
continue
elif(choice == 'w' or choice == 'W'):
while(True):
print('\nPress:\n S to withdraw from savings account \n C to
withdraw from checking account')
account = input()
if( account == 'S' or account == 's'):
while(True):
withdraw_amount = input('Enter amount to withdraw: $')
if('.' in withdraw_amount and
int(withdraw_amount[withdraw_amount.index('.')+1:])>0):
print('Enter amount without any decimal value')
continue
withdraw_amount=int(withdraw_amount)
if(withdraw_amount > checking_bal):
print('Insufficient balance in account')
start()
else:
print('Press C to confirm the withdraw of $',withdraw_amount,' from
the savings account')
con = input()
if( con == 'c' or con == 'C'):
charge = (0.02*float(withdraw_amount))/100
savings_bal = savings_bal - withdraw_amount - charge
print('--'*10)
print('$',withdraw_amount,'withdrawn successfully with a charge of
$',charge)
print('--'*10)
start()
else:
print('First be sure about what you do')
start()
elif( account == 'c' or account == 'C'):
while(True):
withdraw_amount = input('Enter amount to withdraw: $')
if('.' in withdraw_amount and
int(withdraw_amount[withdraw_amount.index('.')+1:])>0):
print('Enter amount without any decimal value')
continue
withdraw_amount=int(withdraw_amount)
if(withdraw_amount > checking_bal):
print('Insufficient balance in account')
start()
else:
print('Press C to confirm the withdraw of $',withdraw_amount,' from
the Checking account')
con = input()
if( con == 'c' or con == 'C'):
checking_bal = checking_bal - withdraw_amount
print('--'*10)
print('$',withdraw_amount,'withdrawn successfully')
print('--'*10)
start()
else:
print('First be sure about what you do')
start()
else:
print('Enter a correct option')
continue
elif(choice == 'e' or choice == 'E'):
print('--'*10)
print('HAVE A GOOD DAY')
print('--'*10)
exit()
else:
print('Please choose a correct option')
start()
checking_bal, savings_bal = 1000.0, 2000.0
print('--'*10)
print('WELCOME TO ATM')
print('--'*10)
access_code = int(input('Enter the Access Code: '))
if(access_code == 2222):
start()
else:
print('--'*10)
print('Wrong access code come later')
print('--'*10)