Compounding Calculator 4.0 "Java Edition"

Source: Internet
Author: User
Tags pow

ImportJava.util.Scanner; Public classFuli { Public Static voidMain (string[] args) {DoubleN=1; Scanner Scanner=NewScanner (system.in); System.out.println ("Please select compound interest Calculation (1) or simple interest calculation (2) or calculated principal (3) or investment year (4) or return rate (5) or annual asset value (6) or monthly asset value (7):"); intChoose=Scanner.nextint (); if(choose==1) {System.out.println ("Please enter the principal:"); floatp=Scanner.nextint (); System.out.println ("Please enter the interest rate:"); floatI=scanner.nextfloat (); System.out.println ("Deposit Time:"); floatn=scanner.nextfloat ();        Fuli (n, P, I, N); }        if(choose==2) {System.out.println ("Please enter the principal:"); floatp=Scanner.nextint (); System.out.println ("Please enter the interest rate:"); floatI=scanner.nextfloat (); System.out.println ("Deposit Time:"); floatn=scanner.nextfloat ();        Danli (P, i,n); }        if(choose==3) {System.out.println ("Please enter to get money:"); DoubleTotal=scanner.nextdouble (); System.out.println ("Please enter the interest rate:"); DoubleI=scanner.nextdouble (); System.out.println ("Deposit Time:"); Doublen=scanner.nextdouble ();                    Yanglaojin (I,total,n); }        if(choose==4) {System.out.println ("Ask for deposit time \ n"); System.out.println ("------------------------------\ n"); System.out.println ("Please enter the principal you deposited: \ n"); Doublep=scanner.nextdouble (); System.out.println ("------------------------------\ n"); System.out.println ("Please enter the rate of return you have saved: \ n"); DoubleI=scanner.nextdouble (); System.out.println ("------------------------------\ n"); System.out.println ("To the last desired amount: \ n"); DoubleTotal=scanner.nextdouble ();        Maigupiao (p,i,total); }        if(choose==5) {System.out.println ("Ask for a rate of return \ n"); System.out.println ("------------------------------\ n"); System.out.println ("Please enter the principal you deposited: \ n"); Doublep=scanner.nextdouble (); System.out.println ("------------------------------\ n"); System.out.println ("Please enter the length of your deposit: \ n"); Doublen=scanner.nextdouble (); System.out.println ("------------------------------\ n"); System.out.println ("To the last desired amount: \ n"); DoubleTotal=scanner.nextdouble ();        Bangzhaotouzhi (p,n,total); }        if(choose==6) {System.out.println ("Amount of money in a certain year \ n"); System.out.println ("------------------------------\ n"); System.out.println ("Please enter the principal you deposited: \ n"); Doublep=scanner.nextdouble (); System.out.println ("------------------------------\ n"); System.out.println ("Please enter the rate of return you have saved: \ n"); DoubleI=scanner.nextdouble (); System.out.println ("------------------------------\ n"); System.out.println ("Please enter the length of your deposit: \ n"); Doublen=scanner.nextdouble ();        Duocitouzhi (P,i,n); }        if(choose==7) {System.out.println ("Monthly equal and principal repayment calculation \ n"); System.out.println ("------------------------------\ n"); System.out.print ("Please enter your loan amount: \ n"); DoubleTotal=scanner.nextdouble (); System.out.println ("------------------------------\ n"); System.out.println ("Please enter the annual interest rate you have borrowed: \ n"); DoubleI=scanner.nextdouble (); System.out.println ("------------------------------\ n"); System.out.println ("Please enter your loan repayment duration (months): \ n"); Doublem=scanner.nextdouble ();                     Daikuan (TOTAL,I,M); }    }    Private Static voidDaikuan (DoubleTotalDoubleIDoublem) {Doublen = m*12; DoubleMoney = Total*i*math.pow ((1.0+i), N)/(Math.pow (1.0+i,n)-1); System.out.println ("Your monthly equal payment is:" +Money ); }    Private Static voidDuocitouzhi (DoublePDoubleIDoubleN) {DoubleTotal=p*math.pow (1 +i,n); System.out.println ("------------------------------\ n"); System.out.println ("The total amount you get is:" +Total ); }    Private Static voidMaigupiao (DoublePDoubleIDoubleTotal ) {i=i*100; DoubleN= (72/i); System.out.println ("------------------------------\ n"); System.out.println ("By compounding the stock-type deposits, get the desired amount of the approximate year required: \ n" +N); }    Private Static voidBangzhaotouzhi (DoublePDoubleNDoubleTotal ) {        DoubleBase= (Double) ((total-p)/p)/N); System.out.println ("The rate of return for doubling the equity-type deposit by compounding is:" +base); }    Private Static voidYanglaojin (DoubleIDoubleTotalDoubleN) {//n time I interest rate         for(intj=1;j<=n;j++) {i= (1+n) *i; }        Doublemoney=total/i; System.out.println ("Required Principal:" +Money ); }    Private Static voidDanli (DoublePDoubleIDoubleN) {DoubleG; G=p+p*i*N; System.out.println ("Simple Interest Final value:" +G); }    Private Static voidFuli (DoubleNDoublePDoubleIDoubleN) { for(intj=1;j<=n;j++) {N= (1+i) *N; }        DoubleF; F=p*N; System.out.println ("End value of compounding:" +g); }    }

Compounding Calculator 4.0 "Java Edition"

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.