在这里插入代码片
package Project;
import java.util.Scanner;
public class Demo02 {
public static void main(String[] args) {
double money;
double Year = 0.0225; //一年年利率 2.25%
double TwoYears = 0.027; //二年年利率 2.7%
double ThreeYears = 0.0324; //三年年利率3.24%
double FiveYears = 0.036; //五年年利率3.6%
Scanner input = new Scanner(System.in);
System.out.println("请输入本金:");
money = input.nextInt();
System.out.println("本金为:"+money+"\n");
//求利息(利息 = 本金 * 年利率 * 存期)
double AInterest = money * Year * 1; // 一年利益
double TwoInterest = money * TwoYears * 2; //二年利息
double ThreeInterest = money * ThreeYears * 3; //三年利息
double FiveInterest = money * FiveYears * 5; //五年利息
//求本息(本息 = 本金 + 利息)
double Aprincipal = money + AInterest; //一年本息
double Twoprincipal = money + TwoInterest; //二年本息
double Threeprincipal = money + ThreeInterest; //三年本息
double Fiveprincipal = money + FiveInterest; //五年本息
System.out.println("存取一年后的本息是:"+Aprincipal+"\n");
System.out.println("存取二年后的本息是:"+Twoprincipal+"\n");
System.out.println("存取三年后的本息是:"+Threeprincipal+"\n");
System.out.println("存取五年后的本息是:"+Fiveprincipal);
}
}
银行提供了整存整取定期存储业务,其存取分为一年、二年、三年、五年,到期凭存单支取本息
最新推荐文章于 2022-12-02 23:47:30 发布