Python realization Shopping cart +ATM machine fifth day

Source: Internet
Author: User
Tags readline

The simulation implements a ATM + Shopping mall program

1. Quota 15000 or custom

2. Implement the shopping mall, buy things into the shopping cart, call the credit card interface checkout

3. can withdraw cash, handling fee 5%

4. monthly invoice, monthly repayment date, overdue, according to the total amount owed 5 daily Interest

5. support multi-account login

6. support transfer between accounts

7. record monthly daily consumption flow

8. provide repayment interface

9.ATM Logging of operation logs

provide management interface, including adding account, user quota, freezing account, etc...

One. decorator for user authentication

function:4,8,10 not implemented


Parameter explanation:

Shopping Cart Account:admin Password:123

Credit Card Transfer account:xinyongka Password:456


Flow chart:

650) this.width=650; "Src=" https://s4.51cto.com/wyfs02/M01/9D/A7/wKioL1mDNpjRQcfmAAA2osh2ueU824.png-wh_500x0-wm_ 3-wmp_4-s_4031087943.png "title=" Liuchengtu.png "alt=" Wkiol1mdnpjrqcfmaaa2osh2ueu824.png-wh_50 "/>


Directory structure diagram:

650) this.width=650; "src=" Https://s1.51cto.com/wyfs02/M02/9D/A6/wKioL1mDNlriI6ccAACbf_oDpnA329.png "title=" Atm.png "alt=" Wkiol1mdnlrii6ccaacbf_odpna329.png "/>


Code:

start.py Module

Timesys,osatm.core.shop buy_shopatm.core.select money_queryatm.core.zhuanzhang tdlogin ():     user1 =  (). Strip ()     passwd1 =  (). Strip ()       (,  , =)  file:        file_name =   (File.readline ())         user1 == file_name[]  passwd1 == file_name[]:             (%  file_name[])              (,  , =)  f:                time_t  =  (Time.strftime (,  time.localtime ()))                  f.write (time_t)               &Nbsp;  f.write (%  (file_name[))         :              (% file_name[])               (,  , =)  f:                 time_t =  (Time.strftime (,  time.localtime ( )))                 f.write ( time_t)                 f.write (%  (file_name[])) Log_sys ():     ()     f_name =  (,  ,  =)     x = f_name.read ()      (x) monye_logs ():      ()     f_name =  (,  , =)     x  = f_name.read ()      (x) start_shop ():     login ()     :          ()         number= (). Strip ()          number == :             buy_shop ()         number == :             time.sleep ()              money_query ()          Number == :            time.sleep ()             transfer ()          number == :             time.sleep ()   &Nbsp;         huankuan ()          number == :             Time.sleep ()             log_sys ()          number == :             time.sleep ()              Monye_logs ()         number == :             backstage ()         :              ()              time.sleep () Start_shop ()

shop.py Module

timedatetimeos,sysbuy_shop_list=[]shop_list= [{: , : },    {: ,  : },    {: , : },    {: , : } ,             ]buy_shop ():     ( )     wages = wages =  (wages)      (% wages)     index, item  (shop_list):                  ()          (Index,item)                                    :                                               shop_number= (). Strip ()         shop_number= (Shop_number)         buy_shop_list.append (Shop_list[shop_number])              buy= ()       buy ==  buy == :            :             money=i buy_shop_list:                 money_total= (i[])                  money += money_ total            money > wages:             (% (i,money,wages))                  money_less= ()                  money_less == Y money_less == y:                      Log_other ()                 :                      money_less == N money_less == n:                          Sys.exit ()             :                         (% (Buy_shop_list,money))                                            (,, =)  f:               time_t= (Time.strftime (,  time.localtime ()))                      f.write (time_t)                      f.write ( %money )                  ( ,  , =)  k:                     xiaofei= (Wages - money)                      = (Money)                      k.write (% (Wages,xiaofei))                  sys.exit ()

Transfer module: zhuangzhan.py

Atm.core.shop buy_shoptime,sys,ostransfer ():    :         other_id= ()              other_pwd = ()             other_id == other_pwd  == :             ()              jine= (). Strip ()                        jine= (Jine)                                          (% jine)             time.sleep ()              (,  , =)  file:                 file_name =  (File.readline ())                  syje= (file_name[])                 syje= (Syje)                 new_money=jine +syje                                 (% jine)                  file.write ()                  file.write (% (file_name[), New_money))    &NBsp;            sys.exit () 


Python realization Shopping cart +ATM machine fifth day

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.