public class SavingAccount {
public static double account = 3000
public static double rate = 0.03
public void update(double rate){
this.rate = rate
}
//flag 用来计算年利息和月利息,flag等true计算月利息
public double calc(double account , double rate , boolean flag){
if(flag)
return account * rate / 12
return account * rate
}
static class Test{
public static void main(String[] args) {
System.out.println("原始存款:"+SavingAccount.account + " \n原始利率:" +SavingAccount.rate )
SavingAccount sa = new SavingAccount()
System.out.println("原始年利息:"+sa.calc(SavingAccount.account,SavingAccount.rate,false))
System.out.println("原始月利息:"+sa.calc(SavingAccount.account,SavingAccount.rate,true))
System.out.println("######请输入新的利率######")
Scanner scanner = new Scanner(System.in)
sa.update(scanner.nextDouble())
System.out.println("更新后的利率:"+SavingAccount.rate)
System.out.println("更新后的年利息:"+sa.calc(SavingAccount.account,SavingAccount.rate,false))
System.out.println("更新后的月利息:"+sa.calc(SavingAccount.account,SavingAccount.rate,true))
//更新后的存款怎么算? 你念亏是多长时间更新一次厅卜?
System.out.println("更新后的存款:"+(SavingAccount.account+sa.calc(SavingAccount.account,SavingAccount.rate,false)))
}
}
}
不扮高穗知道对不对,我理解的是这样的了
你这个刷票行为并不违法物春雀 出现404错误 应罩早该是短时间多次访问形成森埋ddos攻击 如果你是被防火墙封了ip还好 若是真的形成ddos攻击导致所有外网无法访问 原地址的主人 追究必判欢迎分享,转载请注明来源:内存溢出
评论列表(0条)