zoukankan      html  css  js  c++  java
  • 试验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;
    }

    }

  • 相关阅读:
    965. 单值二叉树
    面试题 04.09. 二叉搜索树序列
    99. 恢复二叉搜索树
    98. 验证二叉搜索树
    centos6版本下的Python2.6升级到2.7
    操作MySQL-数据库的安装及Pycharm模块的导入
    操作微信-itchat库的安装
    2018中科大hackergame
    png图片IDAT块异常
    2018网鼎杯misc
  • 原文地址:https://www.cnblogs.com/helloaworld/p/5969004.html
Copyright © 2011-2022 走看看