• 试验4


    package com.wuchaghao.test2;

    import java.util.Scanner;

    public class t2 {
    public static void main(String []args ){

    Scanner scan = new Scanner(System.in);
    System.out.println("请输入一个金额");
    double money = scan.nextDouble();
    System.out.println("请输入年限");
    int year = scan.nextInt();

    for(double i = 0.05;i<=0.08;i+=0.00125){
    System.out.print("利率:"+i);
    double monthper = i/12;
    double monthmoney = (money*monthper)/(1-(1/(Math.pow((1+monthper), (year*12)))));
    System.out.print("月还款:"+monthmoney);
    System.out.println("总还款:"+monthmoney*12*year);

    }

    }

    }

    package com.wuchanghao.test1;

    import java.util.Scanner;

    public class t1 {
    public static void main(String[] args){

    while(true){
    System.out.println("请输入一个数");
    Scanner scan = new Scanner(System.in);
    int num = scan.nextInt();
    double sum= 0;

    for(int i = 1;i<=num;i++){
    tools ts = new tools();
    sum = sum+ts.getnum(i);
    }
    System.out.println("结果是:"+4*sum);
    }
    }

    }


    package com.wuchanghao.test1;

    public class tools {
    public double getnum(int i){
    double result = 0.00;
    if((i%2)!=0){
    result = (1/(double)(2*i-1));
    }
    else{
    result = -(1/(double)(2*i-1));
    }
    return result;
    }

    }

  • 相关阅读:
    如何优雅地使用 Stack Overflow
    Quartz总结
    slf4j-api、slf4j-log4j12以及log4j之间什么关系?
    eclipse 安装 spring boot suite 插件遇到的问题
    Java项目结构总结
    netstat 与 telnet
    微服务架构中的安全认证与鉴权
    git 常用命令
    session 、cookie、token的区别
    List和Set区别
  • 原文地址:https://www.cnblogs.com/helloaworld/p/5969004.html
Copyright © 2020-2023  润新知