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



  • 相关阅读:
    QB学堂济南游记
    区间质数查询 luoguP1865
    基础数据结构 ①(栈|队列|链表)
    图论算法->最短路
    小谈记忆化搜索
    Hibernate其它API
    Hibernate中Session与本地线程绑定
    Hibernate事务代码规范写法
    实体类对象的三种状态
    对实体类的CRUD操作
  • 原文地址:https://www.cnblogs.com/startl/p/12048932.html
Copyright © 2011-2022 走看看