-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmock_atm-2.py
68 lines (56 loc) · 2.62 KB
/
mock_atm-2.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#Mock ATM project
"""
1. The user should see the current date and time after they log in
2. When the user selects option 1, they should be presented with the following:
- How much would you like to withdraw (receive input from the user), output "take your cash"
3. When the user selects option 2, present them with the following options:
- How much would you like to deposit? (receive input from the user), output current balance.
4. When the user selects complaint, present them with the following options:
- What issue will you like to report? (Receive input from the user), output "Thank you for contacting us"
"""
import datetime
name = input('Please enter your name. \n') #ask user for their name
allowedUsers = ['Patient', 'Doxa'] #allowed user
allowedpass = ['Patient@23456', 'Doxa@pass234'] #allowed user's password
now = datetime.datetime.now()
balance = 0
if(name in allowedUsers):
upass = input('Please enter the password. \n') #ask user to enter the password
userId = allowedUsers.index(name)
#check if the user password is allowed
if(upass == allowedpass[userId]):
print('Welcome %s' %name) #welcome the user
print()
#Displaying date time
print('Current date and time: ')
print(now.strftime("%Y-%m-%d %H:%M:%S"))
print()
#Select ATM options
print('These are the available options: ')
print('1. Withdrawal')
print('2. Cash Deposit')
print('2. Complaint')
print()
#Invite user to select an option
selectedOption = int(input('Please select an option: '))
if(selectedOption == 1):
print('How much would you like to withdraw? \n')
userWithdra = int(input('Enter the Amounths: \n')) #invite the user to input the amounths
print()
print('Take your cash') #invite the user to take the cash
elif(selectedOption == 2):
print('How much would you like to deposit? \n')
userDeposit = int(input('Please enter the amounth: \n'))
balances = balance + userDeposit #calculate the current balance
print('Current balance is : ', balances)
print()
elif(selectedOption == 3):
print('What issue will you like to report? \n')
report = input('Please enter the issue: \n')
print('Thank you for contacting us')
else:
print('Invalid option selected, please try again')
else:
print('Password incorect, please try again')
else:
print('Name not found, please try again')