zoukankan      html  css  js  c++  java
  • 第12章第一题

    #_author:Ltx
    #date:2019/12/16
    import time
    import random
    class account:
    '''
    1.存款功能
    2.取款功能
    3.打印交易详情
    3.1--每次交易的时间
    3.2--存款或者取款的金额
    3.3每次交易后的金额
    '''

    def __init__(self,balance=10000):
    self.balance=balance
    @property
    def show(self):
    flag = True
    while flag:
    msg = '''
    1. 存款
    2. 取款
    3. 退出
    '''
    print('请选择你要使用的功能:',msg)
    choose=int(input('请选择:'))
    if choose==1:
    self.deposit
    elif choose==2:
    self.withdrawal
    elif choose==3:
    flag=False
    else:
    print('您输入有误')
    @property
    def deposit(self):
    inp=input('请输入你要存款的金额:')# Please enter the amount you want to deposit
    inp=int(inp)
    print('您存入的金额为',inp,time.ctime())
    self.balance+=inp
    print('您的余额是',self.balance)
    @property
    def withdrawal(self):
    re=int(input('请输入你要取的金额:'))
    if re<self.balance:
    self.balance-=re
    print('取款成功,您的余额为:',self.balance,time.ctime())
    else:
    print('余额不足,您的余额为:',self.balance,'请重新输入取款金额')
    flag=False
    a1=account()
    a1.show



  • 相关阅读:
    阿狸的打字机(bzoj 2434)
    Censoring(bzoj 3940)
    文本生成器(bzoj 1030)
    病毒(bzoj 2938)
    Road(bzoj 2750)
    codevs 2370 小机房的树
    HDU 2838 Cow Sorting
    luogu P2253 好一个一中腰鼓!
    hdu 1166 敌兵布阵
    luogu P1901 发射站
  • 原文地址:https://www.cnblogs.com/startl/p/12048932.html
Copyright © 2011-2022 走看看