长沙 网站建设公司,wordpress 升级 空白,怎样制作ppt文件,中国十大景观设计公司Python学习day5作业Python学习day5作业ATM和购物商城作业需求ATM#xff1a;指定最大透支额度可取款定期还款(每月指定日期还款#xff0c;如15号)可存款定期出账单支持多用户登陆#xff0c;用户间转帐支持多用户管理员可添加账户、指定用户额度、冻结用户等购物车#xf…Python学习day5作业Python学习day5作业ATM和购物商城作业需求ATM指定最大透支额度可取款定期还款(每月指定日期还款如15号)可存款定期出账单支持多用户登陆用户间转帐支持多用户管理员可添加账户、指定用户额度、冻结用户等购物车商品信息- 数量、单价、名称用户信息- 帐号、密码、余额用户可充值购物历史信息允许用户多次购买每次可购买多件余额不足时进行提醒用户退出时 输出当次购物信息用户下次登陆时可查看购物历史商品列表分级显示1. 程序说明购物商城实现功能如下博客多用户登录商品按二级菜单显示充值功能多次购买每次购买多件余额不足提示充值可查看购物历史ATM实现功能如下指定最大透支额度可取款定期还款(每月指定日期还款如15号)可存款定期出账单支持多用户登陆用户间转帐支持多用户管理员可添加账户、指定用户额度、冻结用户等2. 基本流程图3. 程序测试帐号用户/密码ATM普通用户1000/abc、1001/1001ATM管理用户admin/abc购物商城test/test4. 程序结构:.├── Atm # ATM主程目录│ ├── __init__.py│ ├── api # ATM程序API目录│ │ ├── __init__.py│ │ ├── __pycache__│ │ │ ├── __init__.cpython-35.pyc│ │ │ └── pay1.cpython-35.pyc│ │ └── pay.py # ATM支付api│ ├── bin # ATM执行文件目录│ │ ├── __init__.py│ │ ├── atm.py # ATM执行程序普通用户登录入口│ │ └── manager.py # ATM管理员登录入口│ ├── conf # ATM配置目录│ │ ├── __init__.py│ │ ├── __pycache__│ │ │ ├── __init__.cpython-35.pyc│ │ │ └── settings.cpython-35.pyc│ │ └── settings.py # ATM配置文件│ ├── core # ATM主要逻辑程序目录│ │ ├── __init__.py│ │ ├── __pycache__│ │ │ ├── __init__.cpython-35.pyc│ │ │ ├── accounts.cpython-35.pyc│ │ │ ├── auth.cpython-35.pyc│ │ │ ├── bill_date.cpython-35.pyc│ │ │ ├── db_handler.cpython-35.pyc│ │ │ ├── logger.cpython-35.pyc│ │ │ ├── main.cpython-35.pyc│ │ │ └── transaction.cpython-35.pyc│ │ ├── accounts.py # 用于从文件里加载和存储账户数据│ │ ├── auth.py # 用于帐户认证和帐户操作│ │ ├── bill_date.py # 根据年-月生成帐单起止时间模块│ │ ├── db_handler.py # 数据库连接引擎│ │ ├── logger.py # 日志记录模块│ │ ├── main.py # 主逻辑程序│ │ └── transaction.py # 记账\还钱\取钱等所有的与账户金额相关的操作模块│ ├── db # 用户数据存储目录│ │ ├── __init__.py│ │ ├── account_sample.py # 生成一个初始的账户数据 ,把这个数据存成一个以这个账户id为文件名的文件,放在accounts目录就行了,程序自己去会这里找│ │ └── accounts # 存各个用户的账户数据一个用户一个文件│ │ ├── 1000.json # 一个普通用户账户文件│ │ └── admin.json # 一个管理员用户示例文件│ ├── docs # 程序说明文档目录│ │ └── __init__.py│ └── log # 日志根目录│ ├── __init__.py│ ├── access.log # 用户访问和操作的相关日志│ ├── accounts # 存各个用户的帐单数据一个用户一个文件│ │ └── 1000.bills # 一个普通用户的帐单文件│ └── transactions.log # 所有的交易还款等日志├── README.md # readme文件└── Shopping_mall # 购物商城程序目录├── bin # 购物商城执行文件目录│ ├── __init__.py│ └── shopping_mall.py # 购物商城入口程序├── conf # 购物商城配置目录│ ├── __init__.py│ ├── __pycache__│ │ ├── __init__.cpython-35.pyc│ │ ├── goods.cpython-35.pyc│ │ └── settings.cpython-35.pyc│ ├── goods.py # 购物商城商品价格列表│ └── settings.py # 购物商城配置文件├── core # 购物商城主要逻辑程序目录│ ├── __init__.py│ ├── __pycache__│ │ ├── __init__.cpython-35.pyc│ │ ├── accounts.cpython-35.pyc│ │ ├── auth.cpython-35.pyc│ │ ├── db_handler.cpython-35.pyc│ │ ├── logger.cpython-35.pyc│ │ ├── main.cpython-35.pyc│ │ └── shopping.cpython-35.pyc│ ├── accounts.py # 用于从文件里加载和存储账户数据│ ├── auth.py # 用于帐户认证和帐户操作│ ├── db_handler.py # 数据库连接引擎│ ├── logger.py # 日志记录模块│ └── main.py # 主逻辑程序├── db # 用户数据存储目录│ └── accounts # 存各个用户的账户数据一个用户一个文件│ ├── __init__.py│ └── test.json # 一个普通用户账户文件└── log├── access.log # 用户访问和操作的相关日志└── test_shopping.log # 用户购物历史日志5. 程序测试管理员登录失败python Atm/bin/manager.py################ATM admin manager#################account:apassword:aAccount [a] does not exist!account:apassword:aAccount [a] does not exist!account:apassword:aAccount [a] does not exist!2017-01-27 01:47:07,377 - access - ERROR - account [a] too many login attemptsProcess finished with exit code 0管理员登录(不允许普通用户登录)python Atm/bin/manager.py################ATM admin manager#################account:1000password:abcPermission deniedProcess finished with exit code 0################ATM admin manager#################account:adminpassword:abc------- Admin erea ---------1. 添加账户2. 查询用户信息3. 用户信息修改(冻结帐户、用户信用卡额度等)4. 生成全部用户帐单5. 退出:1001Option does not exist!------- Admin erea ---------1. 添加账户2. 查询用户信息3. 用户信息修改(冻结帐户、用户信用卡额度等)4. 生成全部用户帐单5. 退出:1account id:1001password:1001Account [1001] is exist,try another account.account id:1002password:1002account [1002] added sucessed------- Admin erea ---------1. 添加账户2. 查询用户信息3. 用户信息修改(冻结帐户、用户信用卡额度等)4. 生成全部用户帐单5. 退出:2Please input your query account id:1002pay_day :22credit :15000status :0balance :15000id :1002enroll_date :2017-01-27expire_date :2022-01-26------- Admin erea ---------1. 添加账户2. 查询用户信息3. 用户信息修改(冻结帐户、用户信用卡额度等)4. 生成全部用户帐单5. 退出:2Please input your query account id:1001pay_day :22credit :15000status :0id :1001balance :15000enroll_date :2017-01-27expire_date :2022-01-26------- Admin erea ---------1. 添加账户2. 查询用户信息3. 用户信息修改(冻结帐户、用户信用卡额度等)4. 生成全部用户帐单5. 退出::3account id:1001You can choose the items like this:{password: abc,credit: 15000,status: 0,expire_date: 2021-01-01,pay_day: 22}Input modify items(json):{credit:20000,pay_day: 23}Account infomation updated!------- Admin erea ---------1. 添加账户2. 查询用户信息3. 用户信息修改(冻结帐户、用户信用卡额度等)4. 生成全部用户帐单5. 退出:2Please input your query account id:1001pay_day :23credit :20000status :0balance :15000id :1001enroll_date :2017-01-27expire_date :2022-01-26------- Admin erea ---------1. 添加账户2. 查询用户信息3. 用户信息修改(冻结帐户、用户信用卡额度等)4. 生成全部用户帐单5. 退出::2Please input your query account id:0Get account [0] info pemission denied!------- Admin erea ---------1. 添加账户2. 查询用户信息3. 用户信息修改(冻结帐户、用户信用卡额度等)4. 生成全部用户帐单5. 退出:2Please input your query account id:0Get account [0] info pemission denied!------- Admin erea ---------1. 添加账户2. 查询用户信息3. 用户信息修改(冻结帐户、用户信用卡额度等)4. 生成全部用户帐单5. 退出:2Please input your query account id:0Get account [0] info pemission denied!------- Admin erea ---------1. 添加账户2. 查询用户信息3. 用户信息修改(冻结帐户、用户信用卡额度等)4. 生成全部用户帐单5. 退出:4------------------Account bill:------------------------------------------End------------------------------------------Account bill:-------------------expire_date :2021-01-01credit :15000enroll_date :2016-01-02status :0balance :4265.0pay_day :22id :1000Today is not the bill generation day!Account [1000] need to repay [10735.0]-----------------------End------------------------------------------Account bill:-------------------expire_date :2022-01-26id :1001pay_day :23status :0balance :15000enroll_date :2017-01-27credit :20000Today is not the bill generation day!Account [1001] need to repay [5000]-----------------------End------------------------------------------Account bill:-------------------expire_date :2022-01-26credit :15000pay_day :22status :0balance :15000enroll_date :2017-01-27id :1002Today is not the bill generation day!Account [1002] neednt to repay.-----------------------End------------------------------------------Account bill:------------------------------------------End------------------------------- Admin erea ---------1. 添加账户2. 查询用户信息3. 用户信息修改(冻结帐户、用户信用卡额度等)4. 生成全部用户帐单5. 退出:5###################Bye,thanks!####################普通用户登录(不允许管理员登录)python Atm/bin/atm.py##################Welcome to ATM##################account:1000password:abc------- Oldboy Bank ---------1. 账户信息2. 还款(示例)3. 取款(示例)4. 转账5. 存款6. 账单7. 退出:1status :0pay_day :22enroll_date :2016-01-02balance :4265.0expire_date :2021-01-01credit :15000id :1000------- Oldboy Bank ---------1. 账户信息2. 还款(示例)3. 取款(示例)4. 转账5. 存款6. 账单7. 退出:2--------- BALANCE INFO --------Credit : 15000Balance: 4265.0Tip: [b] to backInput repay amount:2002017-01-28 09:49:30,934 - transaction - INFO - account:1000 action:repay amount:200.0 interest:0.0New Balance:4465.0Tip: [b] to backInput repay amount:b------- Oldboy Bank ---------1. 账户信息2. 还款(示例)3. 取款(示例)4. 转账5. 存款6. 账单7. 退出:3--------- BALANCE INFO --------Credit : 15000Balance: 4465.0Tip: [b] to backInput withdraw amount:2002017-01-28 09:49:44,162 - transaction - INFO - account:1000 action:withdraw amount:200.0 interest:10.0New Balance:4255.0Tip: [b] to backInput withdraw amount:b------- Oldboy Bank ---------1. 账户信息2. 还款(示例)3. 取款(示例)4. 转账5. 存款6. 账单7. 退出:4--------- BALANCE INFO --------Credit : 15000Balance: 4255.0(Tip: input [b] to back)Input receiver:1001Input transfer amount:2002017-01-28 09:50:06,723 - transaction - INFO - account:1000 action:transfer amount:200.0 interest:10.0New Balance:4045.02017-01-28 09:50:06,723 - transaction - INFO - account:1001 action:receive amount:200.0 interest:0.0Input receiver:b------- Oldboy Bank ---------1. 账户信息2. 还款(示例)3. 取款(示例)4. 转账5. 存款6. 账单7. 退出:5--------- BALANCE INFO --------Credit : 15000Balance: 4045.0(Tip: input [b] to back)Input your save amount:4002017-01-28 09:53:45,354 - transaction - INFO - account:1000 action:save amount:400.0 interest:0.0New Balance:4445.0------- Oldboy Bank ---------1. 账户信息2. 还款(示例)3. 取款(示例)4. 转账5. 存款6. 账单7. 退出:6Please input the date you will query like [2016-12]2016-12Account [1000] bills:--------------------------------------------------bill_date: 2017-1 account_id: 1000 need_repay: 10555bill_date: 2017-1 account_id: 1000 need_repay: 10555Account [1000] history log:----------------------------------------------------------------------------------------------------------- Oldboy Bank ---------1. 账户信息2. 还款(示例)3. 取款(示例)4. 转账5. 存款6. 账单7. 退出:6Please input the date you will query like [2016-12]2017-01Account [1000] bills:--------------------------------------------------bill_date: 2017-1 account_id: 1000 need_repay: 10555bill_date: 2017-1 account_id: 1000 need_repay: 10555Account [1000] history log:--------------------------------------------------2017-01-25 21:33:43,281 - transaction - INFO - account:1000 action:pay amount:10000.0 interest:0.02017-01-25 22:16:26,609 - transaction - INFO - account:1000 action:pay amount:100.0 interest:0.02017-01-25 22:16:52,347 - transaction - INFO - account:1000 action:pay amount:100.0 interest:0.02017-01-26 21:47:42,372 - transaction - INFO - account:1000 action:repay amount:100.0 interest:0.02017-01-26 21:51:13,819 - transaction - INFO - account:1000 action:repay amount:100.0 interest:0.02017-01-26 21:51:24,608 - transaction - INFO - account:1000 action:withdraw amount:500.0 interest:25.02017-01-26 21:53:16,352 - transaction - INFO - account:1000 action:withdraw amount:200.0 interest:10.02017-01-28 09:49:30,934 - transaction - INFO - account:1000 action:repay amount:200.0 interest:0.02017-01-28 09:49:44,162 - transaction - INFO - account:1000 action:withdraw amount:200.0 interest:10.02017-01-28 09:50:06,723 - transaction - INFO - account:1000 action:transfer amount:200.0 interest:10.02017-01-28 09:53:45,354 - transaction - INFO - account:1000 action:save amount:400.0 interest:0.0--------------------------------------------------------- Oldboy Bank ---------1. 账户信息2. 还款(示例)3. 取款(示例)4. 转账5. 存款6. 账单7. 退出:7###################Bye,thanks!####################Process finished with exit code 1购物商城已注册用户登录python Shopping_mall/bin/shopping_mall.py------------Welcome to shopping mall!---------------------------------------------------------------1. Login2. Sign up3. Logout--------------------------------------------------:1Please input your user name and password!user:testpassword:testInput [y|yes] to view your purchase history,[others] means not.Please input:yUser test shopping history:--------------------------------------------------2017-01-17 17:15:39,199 - shopping - INFO - account:test action:shopping product_number:2 goods:Tea cost:293782017-01-17 17:22:13,163 - shopping - INFO - account:test action:shopping product_number:1 goods:Coffee cost:293482017-01-24 21:55:50,796 - shopping - INFO - account:test action:shopping product_number:2 goods:Milk cost:292302017-01-25 00:05:46,534 - shopping - INFO - account:test action:shopping product_number:1 goods:Coffee cost:292002017-01-25 00:06:07,089 - shopping - INFO - account:test action:shopping product_number:1 goods:Coffee cost:291702017-01-25 00:36:53,038 - shopping - INFO - account:test action:shopping product_number:1 goods:Coffee cost:291402017-01-25 21:33:07,174 - shopping - INFO - account:test action:shopping product_number:1 goods:Coffee cost:30110-------------------Species list-------------------0 -- Mobile phone1 -- Car2 -- Drink-----------------------End------------------------[q|b] to quit;[c] to check;[t] to top upInput your choice:tDo you want to charge more money?[y|n|b]yPlease use your ATM account to pay.Please input your top-up amount:1000account:abcpassword:aAccount [abc] does not exist!account:1000password:abc2017-01-28 10:31:52,106 - transaction - INFO - account:1000 action:pay amount:1000.0 interest:0.0Pay successedYour balance is [41310]-------------------Species list-------------------0 -- Mobile phone1 -- Car2 -- Drink-----------------------End------------------------[q|b] to quit;[c] to check;[t] to top upInput your choice:2----Enter Drink-------------------Product list-------------------0.Milk 591.Coffee 302.Tea 311-----------------------End------------------------[q|quit] to quit;[b|back] to back;[c|check] to checkPlease choice the product:1Please input the number of product:2Added [2] [Coffee] into shopping cart,your balance is [40250]2017-01-28 10:32:07,465 - shopping - INFO - account:test action:shopping product_number:2 goods:Coffee cost:40250-------------------Product list-------------------0.Milk 591.Coffee 302.Tea 311-----------------------End------------------------[q|quit] to quit;[b|back] to back;[c|check] to checkPlease choice the product:b-------------------Species list-------------------0 -- Mobile phone1 -- Car2 -- Drink-----------------------End------------------------[q|b] to quit;[c] to check;[t] to top upInput your choice:0----Enter Mobile phone-------------------Product list-------------------0.Iphone7 61881.Iphone7 plus 78882.Xiaomi5 2888-----------------------End------------------------[q|quit] to quit;[b|back] to back;[c|check] to checkPlease choice the product:0Please input the number of product:12017-01-28 10:32:20,656 - shopping - INFO - account:test action:shopping product_number:1 goods:Iphone7 cost:34062Added [1] [Iphone7] into shopping cart,your balance is [34062]-------------------Product list-------------------0.Iphone7 61881.Iphone7 plus 78882.Xiaomi5 2888-----------------------End------------------------[q|quit] to quit;[b|back] to back;[c|check] to checkPlease choice the product:c*********You purchased products as below**********Goods Price Number CostIphone7 6188 1 6188Coffee 30 2 60***********************End************************You total cost: 6248Your balance is [34062]-------------------Product list-------------------0.Iphone7 61881.Iphone7 plus 78882.Xiaomi5 2888-----------------------End------------------------[q|quit] to quit;[b|back] to back;[c|check] to checkPlease choice the product:b-------------------Species list-------------------0 -- Mobile phone1 -- Car2 -- Drink-----------------------End------------------------[q|b] to quit;[c] to check;[t] to top upInput your choice:q*********You purchased products as below**********Goods Price Number CostIphone7 6188 1 6188Coffee 30 2 60***********************End************************You total cost: 6248Your balance is [34062]###################Bye,thanks!####################Process finished with exit code 1购物商城新注册用户python Shopping_mall/bin/shopping_mall.py------------Welcome to shopping mall!---------------------------------------------------------------1. Login2. Sign up3. Logout--------------------------------------------------:2user:test01password:test01-------------------Species list-------------------0 -- Drink1 -- Mobile phone2 -- Car-----------------------End------------------------[q|b] to quit;[c] to check;[t] to top upInput your choice:c*********You purchased products as below**********Goods Price Number Cost***********************End************************You total cost: 0Your balance is [0]-------------------Species list-------------------0 -- Drink1 -- Mobile phone2 -- Car-----------------------End------------------------[q|b] to quit;[c] to check;[t] to top upInput your choice:q*********You purchased products as below**********Goods Price Number Cost***********************End************************You total cost: 0Your balance is [0]###################Bye,thanks!####################Process finished with exit code 1