package test; import java.util.Vector; public class DayBang { public static void t01() { int tzsj = 0; //TouZi rootTz = new TouZi(10, tzsj); //TouZi rootTz = new TouZi(127.92f, tzsj); //TouZi rootTz = new TouZi(12792, tzsj); TouZi rootTz = new TouZi(20000, tzsj); System.out.println( " All amounts in minutes, round " ); System.out.println( " Match period, "+ rootTz.chq + months , After that, the investment , Need extension "+ rootTz.chq + months in order to receive benefits " ); System.out.println( " Return period, "+ rootTz.hbq + months , After that, the investment , "+ RootTz.hbq +" months return " ); System.out.println( " A handling rate :" + rootTz.souXu ); System.out.println( " Nominal interest rate :" + (rootTz.souXu + rootTz.shouYi ) ); System.out.println( " Rate of return :" + rootTz.shouYi ); System.out.println( " The principal :" + rootTz.tzze ); Vector<TouZi> vec = new Vector<TouZi>(); vec.add(rootTz); System.out.println( "==============================" ); for(int i=0; i<120; i++) { System.out.println( " Month :" + i ); int zsr = 0; // Total revenue for(int j = vec.size()-1; j>=0; j-- ) { TouZi tmp = vec.elementAt(j); if(tmp.srjs<i) { vec.remove(j); continue; } } for(int j = 0; j<vec.size(); j++ ) { TouZi tmp = vec.elementAt(j); if(tmp.srks<=i && tmp.srjs>=i) { zsr += tmp.shouRu; System.out.println( " Investment of time : " + tmp.tzsj + " \t Investment :" + tmp.tzze + " \t Principal :" + tmp.benJin + " \t Income :" + tmp.shouRu ); //System.out.println( "tzsj: " + tmp.tzsj + " \ttzze:" + tmp.tzze + " \tbj:" + tmp.benJin + " \tsr:" + tmp.shouRu ); } } if(zsr>0) { TouZi newTz = new TouZi(zsr, i); vec.add(newTz); } System.out.println( " Total revenue :" + zsr ); //System.out.println( "zsr:" + zsr ); System.out.println( "==============================" ); } System.out.println( " All amounts in minutes, round " ); System.out.println( " Match period, "+ rootTz.chq + months , After that, the investment , Need extension "+ rootTz.chq + months in order to receive benefits " ); System.out.println( " Return period, "+ rootTz.hbq + months , After that, the investment , "+ RootTz.hbq +" months return " ); System.out.println( " A handling rate :" + rootTz.souXu ); System.out.println( " Nominal interest rate :" + (rootTz.souXu + rootTz.shouYi ) ); System.out.println( " Rate of return :" + rootTz.shouYi ); } /** * @param args */ public static void main(String[] args) { t01(); } }

package test; /** * All amounts in minutes, round * Match period, the default for a month , After that, the investment , Need extension of one month in order to receive benefits * Return period, the default for 12 months , After that, the investment , Divided into 12 months back * A handling rate : Default 6.6% * Nominal interest rate : Default 12% * Rate of return :12%-6.6%=5.4% * * @author Administrator * */ public class TouZi { public int benJin = 0; // Monthly return of principal public float souXu = 0.066f; // A handling rate public int hbq = 12; // Return period, the default for 12 months , After that, the investment , Divided into 12 months back public int tzze = 0; // Total investment public float shouYi = 0.09f; // Rate of return //public float shouYi = 0.09f; // Rate of return //public float mysr = 0; // Nominal income public int shouRu = 0; // Actual income public int tzsj = 0; // Investment of time public int chq = 1; // Match period, the default for a month , After that, the investment , Need extension of one month in order to receive benefits //public int chq = 0; // Match period, the default for a month , After that, the investment , Need extension of one month in order to receive benefits public int srks = 2; // Income start time public int srjs = 13; // Income end time public TouZi(int tzze, int tzsj) { this.tzze = tzze; benJin = (int)(tzze / (hbq * (1 + souXu ))); shouRu = (int)(benJin * (1 + souXu + shouYi )); this.tzsj = tzsj; srks = tzsj + 1 + chq; srjs = tzsj + chq + hbq; } }

All the amount is divided into units, rounded to match the period of 1 month, ie, capital investment, the need for extension of 1 month to get the income return period of 12 months, that is, capital investment, the sub-commission rate of return of 12 months : 0.066

Nominal interest rate: 0.156

Yield: 0.09

Principal cast: 20,000

==============================

Month: 0

Total Revenue: 0

==============================

Month: 1

Total Revenue: 0

==============================

Month: 2

Investment of time: 0 Investment: 20000 Principal: 1563 Revenue: 1806

Total Revenue: 1806

==============================

Month: 3

Investment of time: 0 Investment: 20000 Principal: 1563 Revenue: 1806

Total Revenue: 1806

==============================

Month: 4

Investment of time: 0 Investment: 20000 Principal: 1563 Revenue: 1806

Investment: 2 Investment: 1806 Principal: 141 Income: 162

Total Revenue: 1968

==============================

Month: 5

Investment of time: 0 Investment: 20000 Principal: 1563 Revenue: 1806

Investment: 2 Investment: 1806 Principal: 141 Income: 162

Investment of time: 3 Investment: 1806 Principal: 141 Income: 162

Total Revenue: 2130

==============================

Month: 6

Investment of time: 0 Investment: 20000 Principal: 1563 Revenue: 1806

Investment: 2 Investment: 1806 Principal: 141 Income: 162

Investment of time: 3 Investment: 1806 Principal: 141 Income: 162

Investment Time: 4 Investment: 1968 Principal: 153 Income: 176

Total Revenue: 2306

==============================

Month: 7

Investment of time: 0 Investment: 20000 Principal: 1563 Revenue: 1806

Investment: 2 Investment: 1806 Principal: 141 Income: 162

Investment of time: 3 Investment: 1806 Principal: 141 Income: 162

Investment Time: 4 Investment: 1968 Principal: 153 Income: 176

Investment: 5 Investment: 2130 Principal: 166 Income: 191

Total Revenue: 2497

==============================

Month: 8

Investment of time: 0 Investment: 20000 Principal: 1563 Revenue: 1806

Investment: 2 Investment: 1806 Principal: 141 Income: 162

Investment of time: 3 Investment: 1806 Principal: 141 Income: 162

Investment Time: 4 Investment: 1968 Principal: 153 Income: 176

Investment: 5 Investment: 2130 Principal: 166 Income: 191

Investment: 6 investment: 2306 Principal: 180 Income: 208

Total Revenue: 2705

==============================

Month: 9

Investment of time: 0 Investment: 20000 Principal: 1563 Revenue: 1806

Investment: 2 Investment: 1806 Principal: 141 Income: 162

Investment of time: 3 Investment: 1806 Principal: 141 Income: 162

Investment Time: 4 Investment: 1968 Principal: 153 Income: 176

Investment: 5 Investment: 2130 Principal: 166 Income: 191

Investment: 6 investment: 2306 Principal: 180 Income: 208

Investment: 7 Investment: 2497 Principal: 195 Income: 225

Total Revenue: 2930

==============================

Month: 10

Investment of time: 0 Investment: 20000 Principal: 1563 Revenue: 1806

Investment: 2 Investment: 1806 Principal: 141 Income: 162

Investment of time: 3 Investment: 1806 Principal: 141 Income: 162

Investment Time: 4 Investment: 1968 Principal: 153 Income: 176

Investment: 5 Investment: 2130 Principal: 166 Income: 191

Investment: 6 investment: 2306 Principal: 180 Income: 208

Investment: 7 Investment: 2497 Principal: 195 Income: 225

Investment Time: 8 Investment: 2705 Principal: 211 Income: 243

Total Revenue: 3173

==============================

Month: 11

Investment of time: 0 Investment: 20000 Principal: 1563 Revenue: 1806

Investment: 2 Investment: 1806 Principal: 141 Income: 162

Investment of time: 3 Investment: 1806 Principal: 141 Income: 162

Investment Time: 4 Investment: 1968 Principal: 153 Income: 176

Investment: 5 Investment: 2130 Principal: 166 Income: 191

Investment: 6 investment: 2306 Principal: 180 Income: 208

Investment: 7 Investment: 2497 Principal: 195 Income: 225

Investment Time: 8 Investment: 2705 Principal: 211 Income: 243

Investment Time: 9 Investment: 2930 Principal: 229 Income: 264

Total Revenue: 3437

==============================

Month: 12

Investment of time: 0 Investment: 20000 Principal: 1563 Revenue: 1806

Investment: 2 Investment: 1806 Principal: 141 Income: 162

Investment of time: 3 Investment: 1806 Principal: 141 Income: 162

Investment Time: 4 Investment: 1968 Principal: 153 Income: 176

Investment: 5 Investment: 2130 Principal: 166 Income: 191

Investment: 6 investment: 2306 Principal: 180 Income: 208

Investment: 7 Investment: 2497 Principal: 195 Income: 225

Investment Time: 8 Investment: 2705 Principal: 211 Income: 243

Investment Time: 9 Investment: 2930 Principal: 229 Income: 264

Investment: 10 Investment: 3173 Principal: 248 Income: 286

Total Revenue: 3723

==============================

Month: 13

Investment of time: 0 Investment: 20000 Principal: 1563 Revenue: 1806

Investment: 2 Investment: 1806 Principal: 141 Income: 162

Investment of time: 3 Investment: 1806 Principal: 141 Income: 162

Investment Time: 4 Investment: 1968 Principal: 153 Income: 176

Investment: 5 Investment: 2130 Principal: 166 Income: 191

Investment: 6 investment: 2306 Principal: 180 Income: 208

Investment: 7 Investment: 2497 Principal: 195 Income: 225

Investment Time: 8 Investment: 2705 Principal: 211 Income: 243

Investment Time: 9 Investment: 2930 Principal: 229 Income: 264

Investment: 10 Investment: 3173 Principal: 248 Income: 286

Investment: 11 Investment: 3437 Principal: 268 Income: 309

Total Revenue: 4032

==============================

Month: 14

Investment: 2 Investment: 1806 Principal: 141 Income: 162

Investment of time: 3 Investment: 1806 Principal: 141 Income: 162

Investment Time: 4 Investment: 1968 Principal: 153 Income: 176

Investment: 5 Investment: 2130 Principal: 166 Income: 191

Investment: 6 investment: 2306 Principal: 180 Income: 208

Investment: 7 Investment: 2497 Principal: 195 Income: 225

Investment Time: 8 Investment: 2705 Principal: 211 Income: 243

Investment Time: 9 Investment: 2930 Principal: 229 Income: 264

Investment: 10 Investment: 3173 Principal: 248 Income: 286

Investment: 11 Investment: 3437 Principal: 268 Income: 309

Investment Time: 12 Investment: 3723 Principal: 291 Income: 336

Total Revenue: 2562

==============================

Month: 15

Investment: 2 Investment: 1806 Principal: 141 Income: 162

Investment of time: 3 Investment: 1806 Principal: 141 Income: 162

Investment Time: 4 Investment: 1968 Principal: 153 Income: 176

Investment: 5 Investment: 2130 Principal: 166 Income: 191

Investment: 6 investment: 2306 Principal: 180 Income: 208

Investment: 7 Investment: 2497 Principal: 195 Income: 225

Investment Time: 8 Investment: 2705 Principal: 211 Income: 243

Investment Time: 9 Investment: 2930 Principal: 229 Income: 264

Investment: 10 Investment: 3173 Principal: 248 Income: 286

Investment: 11 Investment: 3437 Principal: 268 Income: 309

Investment Time: 12 Investment: 3723 Principal: 291 Income: 336

Investment Time: 13 Investment: 4032 Principal: 315 Income: 364

Total Revenue: 2926