python ---待修改,ATM取款系统
来源:互联网 发布:免费数据库同步软件 编辑:程序博客网 时间:2024/05/29 17:50
待修改,ATM取款系统
root@kali:~/python/atm# cat atm.py #!/usr/bin/python# --*-- coding:utf-8 --*--import tabcreditcradinitmoney = 15000def buy():#商城购物 f_shoplist = file('shoplist.txt') products = [] prices = [] buyshop = [] for p in f_shoplist.readlines(): new_p = p.split() products = new_p[0] prices = new_p[1] print products,prices while True: choice = raw_input('请输入要购买的产品:') f_choice = choice.strip() print f_choice def deposit(cunkuanmoney,cunkuantotalmoney):#存款 #cunkuanmoney = raw_input('请输入你要存款的金额:') x = cunkuanmoney print type(x) cunkuantotal = 0 f_cunkuan = file('xiaofeiqingdan.txt','r+') f_cunkuan.write('你存款的金额是:\t') f_cunkuan.flush() f_cunkuan.write(x) f_cunkuan.flush() y = cunkuantotalmoney + x print '你现在可用的金额为%d' % y f_cunkuan.write('\n可用金额是:\t') f_cunkuan.flush() f_cunkuan.write(y) f_cunkuan.flush() f_cunkuan.close()def withdraw(qukuanmoney):#取款 #creditcarddrawmoney = int(raw_input('请输入你要取款的金额:')) shouxifeimoney = qukuanmoney*0.05 print '你取款的金额%d的手续费为%d'%(qukuanmoney,shouxifeimoney) withdrawlfetmoney = 15000 - qukuanmoney - shouxifeimoney print '你现在可用余额为%d' % withdrawlfetmoneydef creditcardmoneyleft(xiaofeimoney,liximoney,totalmoney):#查询余额 totalmoney = xiaofeimoney + liximoney print '-------------------------------' print '你的消费的金额为% d'% xiaofeimoney print '你的利息累加的金额为% d'% liximoney print '你的总可用的余额为% d'% totalmoney print '-------------------------------'def searchbill(): print 'searchbill()''''修改密码要求:旧密码验证后才能提示修改新密码新密码需输入两次。两次相同即可通过密码长度必须在6位以上'''def modpassword(): print 'modpassword()' pd_old = raw_input('请输入信用卡的旧的密码:') if pd_old == '123456': moduser = [] modpd = [] moduserinfo = [] f1 = open('userinfo.txt','r') #print type(f1) for p in f1.readlines(): new_p = p.split() moduser.append(new_p[0]) modpd.append(new_p[1]) f1.close() print moduser,modpd moduserinfo.append(moduser[0]) moduserinfo.append(modpd[0]) print moduserinfo pd_new1 = raw_input('请输入新信用卡密码,至少6位以上:') pd_new2 = raw_input('请再次输入新信用卡密码,至少6位以上:') if pd_new1 == pd_new2: f2 = open('userinfo.txt','r+') f2.write(moduserinfo[1]) f2.close() print '恭喜您!信用卡密码修改成功!' else: print '你输入的两次新的信用卡密码不相同!请重新输入!' else: print '你输入的信用卡密码错误,请重新输入!''''转账要求:额度不能低于100元,额度不能高于20000元必须为100的整数倍,扣除手续费10%将该笔记录写入账单中'''def tranfer(): print 'tranfer()'def gongneng(): print '''请选择操作的业务:(输入q退出系统) (1) 消费商城购物 (2) 查询余额 (3) 存款 (4) 取款 (5) 转账 (6) 查询账单 (7) 修改密码''' while True: choice = raw_input('请输入需要操作业务编号:') f_choice = choice.strip() if f_choice != 'q': if f_choice == '1': buy() elif f_choice == '2': creditcardmoneyleft(15000,0,15000) elif f_choice == '3': deposit() elif f_choice == '4': withdraw(234) elif f_choice == '5': tranfer() elif f_choice == '6': searchbill() else: modpassword() else: print '你已经退出中国银行ATM取款系统!欢迎下次光临!' exit()while True: user = [] pd = [] file = file('userinfo.txt','r+') for p in file.readlines(): new_p = p.split() user.append(new_p[0]) pd.append(new_p[1]) file.close() #print user[0],pd[0] creditcard = raw_input('请输入信用卡卡号:') #f_creditcard = creditcard.strip() if creditcard == user[0]: creditcardpd = pd[0] while True: creditcardpassword = raw_input('请输入信用卡密码:') #f_creditcardpassword = creditcardpassword.strip() if creditcardpassword != creditcardpd: print '输入的密码%s不对,请重新输入密码' % creditcardpassword else: print '恭喜你!欢迎进入中国银行ATM取款系统!' gongneng() else: print '输入的信用卡号%s错误!请重新输入的你的信用卡号码!' % creditcardroot@kali:~/python/atm#
阅读全文
1 0
- python ---待修改,ATM取款系统
- ATM银行取款系统
- 自动取款机ATM取款系统 课题项目
- ATM取款机系统模拟仿真
- 模拟ATM自动取款机系统
- 银行ATM存取款机系统
- 银行ATM存取款机系统
- python--ATM取款机_最终完善版
- ATM系统实现[11]——取款窗口[00原创]
- <1>c语言实现ATM存取款系统(数组)
- <4>c语言实现ATM存取款系统(链表)
- ATM自动取款机系统的功能需求分析
- 第九章:银行ATM存取款机系统
- C语言实现 ATM机存取款系统
- ATM自动存取款系统(第二版)
- C#基础-031 模拟ATM机存取款系统
- ATM取款机模拟
- ATM取款机程序
- [python + pillow] 修改图片的尺寸
- 服务器提示Can’t assignrequested address的问题分析
- 【Jmeter】BeanShell断言--数据处理
- python008 -- 函数及高阶函数
- android 换肤
- python ---待修改,ATM取款系统
- DDoS攻击原理及防护方法论
- 毕业
- 士为知己者死,女为悦己者容
- YoMail Group | 办公室如何正正经经聊聊天
- 2132: 中南大学2017年ACM暑期集训前期训练题集(入门题)
- JAVA语句
- 再见,我的高中
- 感谢!《夜空守望者》