题面
大家好,昨天停更了一次,因为买的二手苹果pro电脑,有很多问题没有 明白,在二手商家的指导下,完成重装系统,再装双系统。等等操作。再去健身房,基本上人已累倒。
新的改变
使用了新的mac电脑,今天上午教瑜伽,再去取鸡蛋,5个小时。回来重新整理思路,弄出的这段代码。
这是类的部分。
class Account:
def __init__(self,id_name=0,balance=100,annual_interest_rate=0.00):
self.id_name = id_name
self.balance= balance
self.annual_interest_rate = annual_interest_rate/100
def set_id_name(self,id_name):
self.id_name = id_name
def get_id_name(self):
return self.id_name
def set_balance(self, balance):
self.balance = balance
def get_balance(self):
return self.balance
def set_annual_interest_rate(self,annual_interest_rate):
self.annual_interest_rate = annual_interest_rate
def get_monthly_interest_rate(self):
return self.annual_interest_rate / 12
def get_withdraw(self,with_money):
return self.balance - with_money
def get_deposit(self,deposit_mon):
return self.balance + deposit_mon
def get_monthly_interest(self):
a = self.balance * self.get_monthly_interest_rate()
return round(a,5)
这里是main的部分
def main():
withdraw = eval(input("Enter withdraw money: "))
deposit = eval(input("Enter deposit money: "))
base_date= exCode07.Account(1122,20000,4.5)
get_deposit_money =base_date.get_deposit(deposit)
get_with_money= base_date.get_withdraw(withdraw)
print(f"withdraw is balance {get_with_money}")
print(f"deposit is balance {get_deposit_money}")
print(f" account id is {base_date.id_name}")
print(f"monthly interest {base_date.get_monthly_interest()}")
print(base_date.annual_interest_rate)
print(base_date.get_monthly_interest_rate())
main()