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



  • 相关阅读:
    vue+sass 下sass不能运行问题
    Servlet3.0的新特性
    Servlet监听器
    Servlet过滤器
    会话跟踪
    Servlet的应用
    Servlet概述
    《南怀瑾讲述99个人生道理》——刘清海编著
    Web应用程序简介
    JDBC学习总结(五)
  • 原文地址:https://www.cnblogs.com/startl/p/12048932.html
Copyright © 2011-2022 走看看